摘要: @Component和@Bean的目的是一样的,都是注册bean到Spring容器中。 @Component VS @Bean @Component 和 它的子类型(@Controller, @Service and @Repository)注释在类上。告诉Spring,我是一个bean,通过类路径 阅读全文
posted @ 2019-09-18 15:28 zoe_java 阅读(11400) 评论(1) 推荐(3) 编辑
摘要: 方法一:Controller中注入service的时候使用@Autowired自动注入,@Qualifier("beanId") 来指定注入哪一个。 方法二:Controller中注入service的时候使用@Resource(type = 类名.class)来指定注入哪一个。 方法三: 1.每个s 阅读全文
posted @ 2019-09-16 23:07 zoe_java 阅读(16712) 评论(1) 推荐(2) 编辑