mirror of https://github.com/elunez/eladmin
refactor: 🧬️优化启动类中打印端口硬编码问题
parent
e602b759bb
commit
50140d8a2c
|
@ -22,6 +22,7 @@ import me.zhengjie.utils.SpringBeanHolder;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.context.ApplicationPidFileWriter;
|
import org.springframework.boot.context.ApplicationPidFileWriter;
|
||||||
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
@ -48,10 +49,11 @@ public class AppRun {
|
||||||
// 监控应用的PID,启动时可指定PID路径:--spring.pid.file=/home/eladmin/app.pid
|
// 监控应用的PID,启动时可指定PID路径:--spring.pid.file=/home/eladmin/app.pid
|
||||||
// 或者在 application.yml 添加文件路径,方便 kill,kill `cat /home/eladmin/app.pid`
|
// 或者在 application.yml 添加文件路径,方便 kill,kill `cat /home/eladmin/app.pid`
|
||||||
springApplication.addListeners(new ApplicationPidFileWriter());
|
springApplication.addListeners(new ApplicationPidFileWriter());
|
||||||
springApplication.run(args);
|
ConfigurableApplicationContext context = springApplication.run(args);
|
||||||
|
String port = context.getEnvironment().getProperty("server.port");
|
||||||
log.info("---------------------------------------------");
|
log.info("---------------------------------------------");
|
||||||
log.info("Local: {}", "http://localhost:8000");
|
log.info("Local: http://localhost:{}", port);
|
||||||
log.info("Swagger: {}", "http://localhost:8000/doc.html");
|
log.info("Swagger: http://localhost:{}/doc.html", port);
|
||||||
log.info("---------------------------------------------");
|
log.info("---------------------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue