juyss

编写一个类,注册为Spring的Bean,然后实现CommandLineRunner接口,重写run()方法即可

@Component
public class OpenBrowser implements CommandLineRunner {

    @Override
    public void run(String... args) throws Exception {
        System.out.println("开始自动加载指定的页面");
        try {
            Runtime.getRuntime().exec("cmd   /c   start   http://localhost:8080/boot01");//可以指定自己的路径
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

分类:

技术点:

相关文章:

  • 2022-02-05
  • 2021-12-19
  • 2021-04-30
  • 2021-11-18
  • 2021-12-24
  • 2022-01-06
  • 2021-05-06
  • 2021-06-11
猜你喜欢
  • 2021-09-29
  • 2021-12-19
  • 2021-12-19
  • 2021-09-11
  • 2021-12-19
相关资源
相似解决方案