springBoot入门三(SpringBoot的启动方式)
????:主要有两种
- 第一种就是我们前面实例中使用的方法,在Controller类中配置EnableAutoConfiguration,创建一个main方法,使SpringApplication启动程序。
- 第一种方法每次只能启动一个控制器,所有比较不常用,常用的是第二种方法
在App类中配置EnableAutoConfiguration和组件扫描ComponentScan,
然后使用SpringApplication启动程序,这样就可以访问多个Controller了。