Spring Boot 核心注解

92 阅读1分钟

@SpringBootApplication  

解释:这是一个组合注解,通常用于主应用程序类,标志着这是 Spring Boot 应用程序的入口点。它包含了其他注解,如@Configuration、@ComponentScan 和@EnableAutoConfiguration。  

@Configuration

解释:标志着一个类作为配置类,它通常用于定义 Bean。

@ComponentScan  

解释:用于指定 Spring 容器扫描组件的基本包路径。