idea报错could not autowired .但是可以正常运行

转 http://www.cnblogs.com/softidea/p/5763285.html

解决办法:

File-->Project Setting-->Facets-->Spring右键删掉

因为创建项目的时候,都是先创建空项目再创建web moduele(你想直接创建web project也可以),一般不会使用spring组件。都是自己配置的。
这时候你要是不小心手滑(手滑原因:因为idea对你spring的配置文件会在上方报警告,然后你一fix,就容易出事),那就会报错无法Autowired。
所以你只要删掉你手滑添加的就可以

原文地址:https://www.cnblogs.com/zipon/p/9910382.html