springboot中报Error starting ApplicationContext错误解决方法
2019-08-09 13:53
204 查看
版权声明:署名,允许他人基于本文进行创作,且必须基于与原先许可协议相同的许可协议分发本文 (Creative Commons)
前言
新手在使用springboot经常犯的错误,在引用其他项目中的类,经常会出现这样的错误。
错误再现
*************************** APPLICATION FAILED TO START *************************** Description: Field commonRepository in com.example.student.service.DocumentServiceImpl required a bean of type 'com.example.student.repository.CommonRepository' that could not be found. Action: Consider defining a bean of type 'com.example.student.repository.CommonRepository' in your configuration. Process finished with exit code 1
造成这样的错误主要原因是启动类放置的问题引起的,比如本项目中启动类应该放在com.example下面而不是放在com.example.student下面
解决方法
1.将启动类放在com.example下面,具体做法:
先用鼠标选中要拆分的文件夹,右键选择ark Directory as,如图所示:
移出来之后再进行之前的操作,如图所示:
这样问题就解决了,再启动就不会出现问题了.
相关文章推荐
- XCode编译警告和错误解决方法集锦
- 配置SqlServer同步时常见的错误以及解决方法
- IAR FOR STM8S 错误 An error occurred while retrieving GDI features: gdi-error [40201]解决方法
- SQL Server 2005附加数据库出错(错误号:5123)解决方法
- 解决 Python.h:没有那个文件或目录 错误的方法
- HTTP 错误 500.19- Internal Server Error 错误解决方法
- Win 7 共享打印机遇到0x000006d9错误的解决方法
- APT Hash sum mismatch错误的常见解决方法总结
- Exchange 2007 OWA中出现“HTTP 错误404”解决方法
- android avd部分错误解决方法
- 预装win8的笔记本用第三方分区软件分区后出现0x0000225错误的解决方法/同理win7
- 命令行下使用javah命令生成.h文件,出现“错误: 无法访问android.app.Activity 找不到android.app.Activity的类文件”的解决方法
- heap corruption detected错误解决方法调试方法以及内存管理相关
- ORA 12560 TNS: 协议适配器错误的解决方法
- 无法向会话状态服务器发出会话状态请求 没有启动 ASP.NET State service错误的解决方法
- eclipse 导入项目后,在工程图标上出现红叉,但是工程中的文件并没有提示错误的解决方法
- PHP错误Warning: Cannot modify header information - headers already sent by解决方法
- CLOSE_WAIT状态错误分析和解决方法(网络连接无法释放)
- Tiny6410开发板linux启动错误 /init: line 102: can't open /r/dev/console: no such file 的解决方法
- 启动 Eclipse时报“Failed to load the JNI shared library jvm.dll”错误的解决方法!