Springboot项目启动后自动弹出页面
启动Application,容器加载完毕,自动弹出页面@Componentpublic class RunHomePage implements CommandLineRunner {public void run(String... args) throws Exception {try {Runtime.getRuntime().ex...
·
启动Application,容器加载完毕,自动弹出页面
@Component
public class RunHomePage implements CommandLineRunner {
public void run(String... args) throws Exception {
try {
Runtime.getRuntime().exec("cmd /c start http://localhost:8080/login.html");
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
这里我是把login.html放在resouce中的static,如果放在tamplates,可以把html去掉,写一个controller来进行访问!
文章我会持续坚持更新,若有问题可以直接联系我,文章会同步到公众号上!微信搜索【雨季的代码人生】或直接扫码关注,回复“问题”即可。
更多推荐
已为社区贡献1条内容
所有评论(0)