2018-12-15 22:32:28 +08:00
|
|
|
|
package com.zyplayer.doc.manage;
|
|
|
|
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
2021-09-25 21:28:37 +08:00
|
|
|
|
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
2018-12-15 22:32:28 +08:00
|
|
|
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
|
|
|
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
|
|
|
|
|
import org.springframework.context.ConfigurableApplicationContext;
|
2019-02-26 23:04:24 +08:00
|
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
2018-12-15 22:32:28 +08:00
|
|
|
|
import org.springframework.core.env.Environment;
|
2019-04-21 16:46:14 +08:00
|
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
2018-12-15 22:32:28 +08:00
|
|
|
|
|
|
|
|
|
|
import java.net.InetAddress;
|
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 程序启动器
|
|
|
|
|
|
*/
|
2019-04-21 16:46:14 +08:00
|
|
|
|
@EnableScheduling
|
2018-12-15 22:32:28 +08:00
|
|
|
|
@SpringBootApplication
|
2019-02-26 23:04:24 +08:00
|
|
|
|
@ComponentScan(basePackages = {"com.zyplayer.doc.manage", "com.zyplayer.doc.data"})
|
2018-12-15 22:32:28 +08:00
|
|
|
|
public class Application extends SpringBootServletInitializer {
|
2021-09-25 21:28:37 +08:00
|
|
|
|
|
2018-12-15 22:32:28 +08:00
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(Application.class);
|
2021-09-25 21:28:37 +08:00
|
|
|
|
|
2018-12-15 22:32:28 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
|
|
|
|
|
return application.sources(Application.class);
|
|
|
|
|
|
}
|
2021-09-25 21:28:37 +08:00
|
|
|
|
|
2018-12-15 22:32:28 +08:00
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
|
ConfigurableApplicationContext application = SpringApplication.run(Application.class, args);
|
|
|
|
|
|
Environment env = application.getEnvironment();
|
|
|
|
|
|
String contextPath = env.getProperty("server.servlet.context-path");
|
|
|
|
|
|
contextPath = Optional.ofNullable(contextPath).orElse("").replaceFirst("/", "");
|
|
|
|
|
|
contextPath = (contextPath.length() <= 0 || contextPath.endsWith("/")) ? contextPath : contextPath + "/";
|
|
|
|
|
|
String hostAddress = InetAddress.getLocalHost().getHostAddress();
|
|
|
|
|
|
String serverPort = env.getProperty("server.port");
|
2018-12-16 22:20:30 +08:00
|
|
|
|
String urlCtx = hostAddress + ":" + serverPort + "/" + contextPath;
|
2018-12-15 22:32:28 +08:00
|
|
|
|
logger.info("\n----------------------------------------------------------\n\t" +
|
|
|
|
|
|
"\t\t地址列表\n\t" +
|
2019-06-29 23:49:20 +08:00
|
|
|
|
"管理地址:http://{}\n" +
|
2018-12-15 22:32:28 +08:00
|
|
|
|
"----------------------------------------------------------",
|
2018-12-26 22:34:20 +08:00
|
|
|
|
urlCtx
|
2018-12-15 22:32:28 +08:00
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|