springboot
文章平均质量分 66
我是西瓜王
there is no same leaf in the world
展开
-
自定义spring-boot-starter自动装配
说明: 自动装配类 的作用相当于启动类,自动装配的入口。starter本身是不用启动的,所以说要调用者项目来加载这个自动配置类来注册bean,所有的bean都要经过这里注册bean@Bean。原创 2023-06-18 17:16:24 · 185 阅读 · 0 评论 -
spring boot自动装配原理
在AutoConfigurationImportSelector搜索selectImports实现方法时会发现有两个,其中一个是实现ImportSelector的selectImports方法,还有一个是实现DeferredImportSelector的selectImports方法。这里自动装配使用的是 @Import一个类 该类实现了ImportSelector 重写selectImports方法该方法返回了String[]数组的对象,数组里面的类都会注入到spring容器当中。原创 2023-06-18 15:42:29 · 188 阅读 · 0 评论