- 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();