SpringBootApplication注解说明
2026/5/9 12:54:06 网站建设 项目流程

SpringBootApplication是组合注解。组合了3个注解:

@SpringBootConfiguration:将该类声明为配置类。

@EnableAutoConfiguration:启用自动配置。

@CompomemtScan:启用组件扫描。

@SpringBootApplication is a convenience annotation that adds all of the following:

  • @Configuration: Tags the class as a source of bean definitions for the application context.
  • @EnableAutoConfiguration: Tells Spring Boot to start adding beans based on classpath settings, other beans, and various property settings. For example, if spring-webmvc is on the classpath, this annotation flags the application as a web application and activates key behaviors, such as setting up a DispatcherServlet.
  • @ComponentScan: Tells Spring to look for other components, configurations, and services in the com/example package, letting it find the controllers.

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询