会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
zoe_java
博客园
首页
新随笔
联系
订阅
管理
2019年9月18日
Spring中@Component与@Bean的区别
摘要: @Component和@Bean的目的是一样的,都是注册bean到Spring容器中。 @Component VS @Bean @Component 和 它的子类型(@Controller, @Service and @Repository)注释在类上。告诉Spring,我是一个bean,通过类路径
阅读全文
posted @ 2019-09-18 15:28 zoe_java
阅读(11557)
评论(1)
推荐(3)
2019年9月16日
Spring中 如果该Service有多个实现类,它怎么知道该注入哪个ServiceImpl类?
摘要: 方法一:Controller中注入service的时候使用@Autowired自动注入,@Qualifier("beanId") 来指定注入哪一个。 方法二:Controller中注入service的时候使用@Resource(type = 类名.class)来指定注入哪一个。 方法三: 1.每个s
阅读全文
posted @ 2019-09-16 23:07 zoe_java
阅读(16935)
评论(1)
推荐(2)
公告