maven + spring项目 在eclipse中没问题在idea却报错:could not autowired
来源:互联网 发布:ubuntu当个人日常使用 编辑:程序博客网 时间:2024/06/01 12:07
从其他地方找找到的答案记录一下
解决办法1:
从根本上解决:
File-Project Structure 页面 Facets下删掉 Spring(直接右键Delete)
这个解答是对的。并不会降低安全性!!
因为创建项目的时候,都是先创建空项目再创建web moduele(你想直接创建web project也可以),一般不会使用spring组件。都是自己配置的。
这时候你要是不小心手滑(手滑原因:因为idea对你spring的配置文件会在上方报警告,然后你一fix,就容易出事),那就会报错无法Autowired。
所以你只要删掉你手滑添加的就可以
http://www.oschina.net/question/202626_181237
解决办法2:
降低Autowired检测的级别,不要提示就OK
tellij Idea @Autowired取消提示
Spring bean通过@Autowired注入,spring auto scan配置,在编辑情况下,无法找不到对应的bean,于是提示找不到对应bean的错误。
但build项目是能正常运行的。
可在File – Settings – Inspections。使用搜索功能 找到 Autowired for Bean Class ,
将Severity的级别由之前的error改成warning或其它可以忽略的级别。
http://blog.csdn.net/qq853447917/article/details/50460374
阅读全文
0 0
- maven + spring项目 在eclipse中没问题在idea却报错:could not autowired
- 在eclipse中创建maven项目错误的解决方法:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-qu
- 在Eclipse中使用Maven构建Spring项目
- maven+Spring在Eclipse中搭建多模块企业级项目
- 在Eclipse中使用Maven建立Spring项目
- 在Eclipse中使用Maven构建Spring项目
- 在Eclipse中使用Maven构建Spring项目
- 在idea中搭建maven项目
- 在IDEA中创建maven项目
- idea中将多个spring boot项目放在一个maven项目中
- idea中将多个spring boot项目放在一个maven项目中
- 在IDEA 2017中导入Eclipse项目
- 在IntelliJ IDEA中创建Spring项目
- 在IntelliJ IDEA中创建Spring项目
- 关于在MyEclipse中创建maven webapp项目时报错:Could not resolve archetype org.apache.maven.archetypes
- 在JetBrain IDEA中导入svn上的eclipse maven项目
- 在eclipse中中安装maven项目
- maven项目在idea中spring配置文件引入xml文件和properties文件报错解决方案
- Python学习笔记(15)- 异常
- 几本对于笔试和面试有用的书(干货~)
- 12、mybatis获取自增主键的值
- zhx's contest(快速幂+快速乘法)
- mysql关于utf8_unicode_ci与utf8mb4_unicode_ci的区别
- maven + spring项目 在eclipse中没问题在idea却报错:could not autowired
- PAT
- MongoDB
- 单例模式
- 三星的片子不支持can
- dataTables-使用详细说明整理
- Android面试题
- 互联网公司校招Java面试题总结及答案——京东
- 编译hyperledger fabric官方源码