启动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来进行访问!


文章我会持续坚持更新,若有问题可以直接联系我,文章会同步到公众号上!微信搜索【雨季的代码人生】或直接扫码关注,回复“问题”即可。
在这里插入图片描述

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐