问题描述:Could not autowire

Could not autowire. No beans of ‘***Controller‘ type found
解决方案:

1.检查该实现类是否加上了@Service注解,确保加上
我的代码是AccountController-----AccountService----AccountServiceImpl,因此找到AccountController对应的实现类为AccountServiceImpl要确保该实现类加上了@Service注解。

Could not autowire. No beans of ‘***Controller‘ type found

2.编译器问题

确保代码无误的情况下,可以降低Autowired检测的级别,将Severity的级别由之前的error改成warning或其它可以忽略的级别。IDEA如下图所示:
Could not autowire. No beans of ‘***Controller‘ type found

编译器问题的话最好修改之后关闭编译器重新打开

相关文章: