Spring配置类详解

详情参阅:https://blog.csdn.net/f641385712/category_10035396.html

Note:

Spring中的配置分为Full模式和Lite模式。

Full模式:类上@Configuration + 方法上@Bean 的配置类,会被以Full模式解析加载。

Lite模式:类上没有@Configuration,只有方法上@Bean; 或者 方法上@Bean + 类上@Component/@ComponentScan/@Import/@ImportResource/@Configuration(proxyBeanMethods = false) 的配置类,会被以Lite模式加载解析。

前者运行时会为配置类生成CGLIB代理对象,故方法不能是final或私有的;可以在一个@Bean方法内通过方法调用依赖其他@Bean。后者则与上相反。

详情可参阅:https://fangshixiang.blog.csdn.net/article/details/106127418

原文地址:https://www.cnblogs.com/z-sm/p/14859470.html