
上QQ阅读APP看书,第一时间看更新
1.3.2 入口类
入口类的代码很简单,代码如下:

• @SpringBootApplication:是一个组合注解,包含@EnableAutoConfiguration、@ComponentScan和@SpringBootConfiguration三个注解,是项目启动注解。如果我们使用这三个注解,项目依旧可以启动起来,只是过于烦琐。此时,可用@SpringBootApplication简化。
• @SpringApplication.run:应用程序开始运行的方法。
提示
入口类需要放置在包的最外层,以便能够扫描到所有子包中的类。