springboot启动后直接访问默认路劲
程序员文章站
2024-01-07 17:49:10
...
springboot启动后直接访问默认路劲
@Configuration
public class IndexConfig {
@EventListener({ ApplicationReadyEvent.class })
void applicationReadyEvent() {
System.out.println("正在为您启动应用...");
String url = "http://localhost:8080/UpAndDown/index";
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec("rundll32 url.dll,FileProtocolHandler " + url);
} catch (IOException e) {
e.printStackTrace();
}
}
}