转载请注明来源:四个空格 » IntelliJ IDEA中Mapper接口通过@Autowired注入报错的正确解决方式: 环境 ideaIU-2018.3.4.win: 错误提示: Could not autowire. No beans of 'JwDsBaseinfoCaseMapper' type found. less... (Ctrl+F1) Inspection info:Checks autowiring problems in a bean class. 错误如下图: 解决办法
@Autowired注入Spring Bean,则当前类必须也是Spring Bean才能调用它,不能用new xxx()来获得对象,这种方式获得的对象无法调用@Autowired注入的Bean. 1.类1,加入Spring Pool public class PersonServiceImpl implements PersonService{ public void save(){ System.out.println("This is save for test spring")