
springboot常用注解的作用【详解】
@springbootApplication:springboot启动类上唯一的一个注解,它是一个组合注解。
@SpringBootConfiguration:表明该类为配置类 @EnableAutoConfiguration :启动自动配置功能 @AutoConfigurationPackage:自动配置包 【@SpringBootApplication的Spring Boot应用程序入口类所在的包】registry方法:
@Import(AutoConfigurationImportSelector.class):向容器中导入一个组件AutoConfigurationImportSelector类:
自动配置主要方法:getAutoConfigurationEntry();
通过该方法加载并注册了spring.factories中的所有生效的自动配置类倒到spring容器中
@ComponentScan:用于注解扫描 当ComponentScan注解没有标注basePackages以及value时,扫描路径默认为ComponentScan的类所在的包
👁️ 阅读量:0
© 版权声明:本文《springboot常用注解的作用【详解】》内容均为本站精心整理或网友自愿分享,如需转载请注明原文出处:https://www.zastudy.cn/wen/1686810760a343438.html。