Browse Source

重装系统后测试提交

master
buaixuexideshitongxue 2 months ago
parent
commit
a64abce6cd
  1. 25
      src/main/java/com/biutag/supervision/InvestBootApplication.java

25
src/main/java/com/biutag/supervision/InvestBootApplication.java

@ -1,12 +1,18 @@
package com.biutag.supervision; package com.biutag.supervision;
import org.springframework.boot.ApplicationRunner;
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.web.context.WebServerApplicationContext;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import java.net.InetAddress;
@EnableAsync @EnableAsync
@EnableCaching @EnableCaching
@EnableScheduling @EnableScheduling
@ -17,5 +23,22 @@ public class InvestBootApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(InvestBootApplication.class, args); SpringApplication.run(InvestBootApplication.class, args);
} }
@Bean
public ApplicationRunner applicationRunner(WebServerApplicationContext context, Environment env) {
return args -> {
try {
String ip = InetAddress.getLocalHost().getHostAddress();
int port = context.getWebServer().getPort();
String contextPath = env.getProperty("server.servlet.context-path", "");
System.out.println("\n" +
"===============================================================\n" +
":: 应用启动成功!\n" +
":: 本地地址: http://localhost:" + port + contextPath + "\n" +
":: 外部地址: http://" + ip + ":" + port + contextPath + "\n" +
"===============================================================\n");
} catch (Exception e) {
System.err.println("获取启动信息失败: " + e.getMessage());
}
};
}
} }

Loading…
Cancel
Save