spring启动时报错No qualifying bean of type【bean 】 is defined

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.test.mapper.TbItemMapper] is defined

有两个可能:
第一个:dao层配置的包扫描出现错误
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="com.test.mapper" />
    </bean>

第二个:书写错误
加载配置文件的时候
new ClassPathXmlApplicationContext("classpath:spring/applicationContext*.xml");
里面的classpath对应的文件名和自己写的配置文件的文件名不相符

猜你喜欢

转载自blog.csdn.net/u013772906/article/details/78795817