Spring在自动注入时出现检查异常Could not autowire. No beans of ‘XXX’ type found.
方法一:在Mapper的接口类中
添加@Mapper的同时在上面再加一个@Repository注解
申明Dao类为Bean
方法二:在Service的实现类中
在@Autowired后面添加@Autowired(required = false)参数
表示忽略当前要注入的Bean,如果有直接注入,没有跳过。
Spring在自动注入时出现检查异常Could not autowire. No beans of ‘XXX’ type found.
方法一:在Mapper的接口类中
添加@Mapper的同时在上面再加一个@Repository注解
申明Dao类为Bean
方法二:在Service的实现类中
在@Autowired后面添加@Autowired(required = false)参数
表示忽略当前要注入的Bean,如果有直接注入,没有跳过。