
0关注
552
文章
0
收藏
2
次赞
214532
查看
Ta的博客 更多
SpringBoot 五种获取ApplicationContext的方式java中进行日期时间比较的4种方法SpringBoot整合WebSocket实现前后端互推消息CSS怎么画五角星?SpringBoot中RedisUtils工具类配置及直接使用如何开启基于注解的自动装配?
要使用 @Autowired,需要注册 AutowiredAnnotationBeanPostProcessor,可以有以下两种方式来实现:
引入配置文件中的<bean>下引入 <context:annotation-config>
<beans>
<context:annotation-config />
</beans>
在bean配置文件中直接引入AutowiredAnnotationBeanPostProcessor
<beans>
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
</beans>
引入配置文件中的<bean>下引入 <context:annotation-config>
<beans>
<context:annotation-config />
</beans>
在bean配置文件中直接引入AutowiredAnnotationBeanPostProcessor
<beans>
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
</beans>
0 0