Spring Boot(一)启动方式

  • 1、系统自动生成
    SpringApplication.run(XX.class, args);
  • 2、创建SpringApplication对象
    SpringApplication app = new SpringApplication(DemoApplication.class);
    app.setBannerMode(Banner.Mode.OFF);
    app.run();
  • 3、Fluent Builder API 构造者模式 也可以把参数放在run中
1)
new SpringApplicationBuilder(DemoApplication.class).bannerMode(Banner.Mode.CONSOLE).run();

2)
new SpringApplicationBuilder().sources(DemoApplication.class).bannerMode(Banner.Mode.OFF).run();

3)
new SpringApplicationBuilder().sources(DemoApplication.class).bannerMode(Banner.Mode.OFF).build(args).run();
上一篇:Android 从浏览器启动Activity


下一篇:Spring Boot(二)Customizing the Banner