@Autowired
private UserDaouserDao;
注入UserDao时,报错:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.ischoolbar.programmer.dao.UserDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
原因:spring里没有注入
在applicationContext.xml里加上:
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.ischoolbar.programmer.dao"/>
</bean>
网友评论