2019-05-19 18:54:09 +08:00
|
|
|
package org.jeecg;
|
|
|
|
|
2020-05-03 12:43:53 +08:00
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2019-11-21 18:17:25 +08:00
|
|
|
import org.apache.catalina.Context;
|
|
|
|
import org.apache.tomcat.util.scan.StandardJarScanner;
|
2020-09-13 18:23:23 +08:00
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
2019-05-19 18:54:09 +08:00
|
|
|
import org.springframework.boot.SpringApplication;
|
2020-11-28 17:20:10 +08:00
|
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
2019-05-19 18:54:09 +08:00
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
2020-07-11 12:54:57 +08:00
|
|
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
2019-11-21 18:17:25 +08:00
|
|
|
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
2020-07-11 12:54:57 +08:00
|
|
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
2019-05-19 18:54:09 +08:00
|
|
|
import org.springframework.context.ConfigurableApplicationContext;
|
2019-11-21 18:17:25 +08:00
|
|
|
import org.springframework.context.annotation.Bean;
|
2019-05-19 18:54:09 +08:00
|
|
|
import org.springframework.core.env.Environment;
|
2019-08-24 00:15:45 +08:00
|
|
|
|
2020-05-03 12:43:53 +08:00
|
|
|
import java.net.InetAddress;
|
|
|
|
import java.net.UnknownHostException;
|
|
|
|
|
2019-05-19 18:54:09 +08:00
|
|
|
@Slf4j
|
|
|
|
@SpringBootApplication
|
2020-09-13 18:23:23 +08:00
|
|
|
public class JeecgSystemApplication extends SpringBootServletInitializer {
|
2020-07-11 12:54:57 +08:00
|
|
|
|
2020-05-03 12:43:53 +08:00
|
|
|
@Override
|
2020-07-11 12:54:57 +08:00
|
|
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
2020-09-13 18:23:23 +08:00
|
|
|
return application.sources(JeecgSystemApplication.class);
|
2020-07-11 12:54:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void main(String[] args) throws UnknownHostException {
|
2020-09-13 18:23:23 +08:00
|
|
|
ConfigurableApplicationContext application = SpringApplication.run(JeecgSystemApplication.class, args);
|
2020-07-11 12:54:57 +08:00
|
|
|
Environment env = application.getEnvironment();
|
|
|
|
String ip = InetAddress.getLocalHost().getHostAddress();
|
|
|
|
String port = env.getProperty("server.port");
|
2020-09-13 18:23:23 +08:00
|
|
|
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
|
2020-07-11 12:54:57 +08:00
|
|
|
log.info("\n----------------------------------------------------------\n\t" +
|
|
|
|
"Application Jeecg-Boot is running! Access URLs:\n\t" +
|
|
|
|
"Local: \t\thttp://localhost:" + port + path + "/\n\t" +
|
|
|
|
"External: \thttp://" + ip + ":" + port + path + "/\n\t" +
|
2020-11-28 17:20:10 +08:00
|
|
|
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
|
2020-07-11 12:54:57 +08:00
|
|
|
"----------------------------------------------------------");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* tomcat-embed-jasper引用后提示jar找不到的问题
|
|
|
|
*/
|
|
|
|
@Bean
|
|
|
|
public TomcatServletWebServerFactory tomcatFactory() {
|
|
|
|
return new TomcatServletWebServerFactory() {
|
|
|
|
@Override
|
|
|
|
protected void postProcessContext(Context context) {
|
|
|
|
((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
|
|
|
|
}
|
|
|
|
};
|
2020-05-03 12:43:53 +08:00
|
|
|
}
|
2019-05-19 18:54:09 +08:00
|
|
|
}
|