IDEA报错Checks autowiring problems in a bean class
这是因为bean方法没有加入到spring容器中,虽然已经写了相关的引用语句,但仍无法调用bean方法。方法1 impl文件加@Service注解其作用就相当于applicationContext.xml文件里面的<bean id="IUserService"class="com.zhongruan.service.IUserServiceImpl" scope...
·
这是因为bean方法没有加入到spring容器中,虽然已经写了相关的引用语句,但仍无法调用bean方法。
方法1 impl文件加@Service注解
其作用就相当于applicationContext.xml文件里面的
<bean id="IUserService"
class="com.zhongruan.service.IUserServiceImpl" scope="prototype">
......
</bean>
方法2 dao文件加上@Repository注解
Spring 在容器初始化时将自动扫描 base-package 指定的包及其子包下的所有 class文件,所有标注了@Repository 的类都将被注册为Spring Bean。
更多推荐
已为社区贡献1条内容
所有评论(0)