38 lines
1.5 KiB
38 lines
1.5 KiB
package com.ruoyi;
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
import org.springframework.context.ConfigurableApplicationContext;
|
|
import org.springframework.core.env.Environment;
|
|
|
|
import java.net.InetAddress;
|
|
import java.net.UnknownHostException;
|
|
|
|
/**
|
|
* 启动程序
|
|
*
|
|
* @author ruoyi
|
|
*/
|
|
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
|
public class RuoYiApplication {
|
|
public static void main(String[] args) {
|
|
ConfigurableApplicationContext application = SpringApplication.run(RuoYiApplication.class, args);
|
|
Environment env = application.getEnvironment();
|
|
String ip;
|
|
try {
|
|
ip = InetAddress.getLocalHost().getHostAddress();
|
|
} catch (UnknownHostException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
String port = env.getProperty("server.port");
|
|
String path = env.getProperty("server.servlet.context-path");
|
|
path = path.isEmpty() ? "" : path;
|
|
System.out.println("\n----------------------------------------------------------\n\t"
|
|
+ "Application is running! Access URLs:\n\t"
|
|
+ "swagger-ui: http://localhost:" + port + path + "doc.html\n\t"
|
|
+ "swagger-ui: http://" + ip + ":" + port + path + "doc.html\n\t"
|
|
+ "----------------------------------------------------------");
|
|
}
|
|
}
|