Idea 的@Autowired标红报错

来源:互联网 发布:昆明java 编辑:程序博客网 时间:2024/06/07 01:46

1.在所在的类DAO层加注解@Repository


@Repositorypublic interface UserDao {
...


2.在spring的XML 配置文件中启动 Spring 的自动扫描功能


<!-- 扫描dao包 --><context:component-scan base-package="org.test.dao" />