java.lang.IllegalStateException: Failed to load ApplicationContext

简介: java.lang.IllegalStateException: Failed to load ApplicationContext

java.lang.IllegalStateException: Failed to load ApplicationContext

报错

今天在整合SSM测试service接口时出现了此处错误


0a2653c851af460fa595bd959398a8f1.png


关键词


Failed to load ApplicationContext中文翻译过来就是加载应用配置失败


这样的话就是有配置文件出错


总结


我总结有以下几处错误


1、Spring配置的@PropertySource注解里少写了classpath:前缀


2、Spring配置的@ComponentScan注解里设置的扫描包范围太大,把SpringMVC配置也扫了


3、Spring的配置类导入注解@Import没写


4、Mybatis的配置类比如MybatisConfig中的包扫描Bean的包名拼写错误


我的错误点


我的错误就是第四个,把包名拼错了(itheima少拼一个i),浪费了我一下午时间,希望大家不要像我一样犯如此低级的错误


2d65d23f6d4748949b924e4057485923.png

目录
打赏
0
2
1
0
4
分享
相关文章
java spring 项目若依框架启动失败,启动不了服务提示端口8080占用escription: Web server failed to start. Port 8080 was already in use. Action: Identify and stop the process that’s listening on port 8080 or configure this application to listen on another port-优雅草卓伊凡解决方案
java spring 项目若依框架启动失败,启动不了服务提示端口8080占用escription: Web server failed to start. Port 8080 was already in use. Action: Identify and stop the process that’s listening on port 8080 or configure this application to listen on another port-优雅草卓伊凡解决方案
84 7
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException 问题处理
【5月更文挑战第14天】org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException 问题处理
2005 1
|
7月前
|
Error:java: Compilation failed: internal java compiler error
Error:java: Compilation failed: internal java compiler error
128 1
简单记录在Linux上安装JDK环境的步骤,以及解决运行Java程序时出现Error Could not find or load main class XXX问题
本文记录了在Linux系统上安装JDK环境的步骤,并提供了解决运行Java程序时出现的"Error Could not find or load main class XXX"问题的方案,主要是通过重新配置和刷新JDK环境变量来解决。
261 0
Java异常之【sun.security.validator.ValidatorException: PKIX path building failed: sun.security...】
Java异常之【sun.security.validator.ValidatorException: PKIX path building failed: sun.security...】
258 0
Java异常之【sun.security.validator.ValidatorException: PKIX path building failed: sun.security...】
|
9月前
Failed to bind properties under ‘logging.level‘ to java.util.Map java.lang.String, java.lang.String
Failed to bind properties under ‘logging.level‘ to java.util.Map java.lang.String, java.lang.String
56 0
Spring Boot单元测试报错java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]
Spring Boot单元测试报错java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]
229 0
Caused by: java.lang.UnsatisfiedLinkError: Can‘t load AMD 64-bit .dll on a IA 32-bit platform【已解决】
Caused by: java.lang.UnsatisfiedLinkError: Can‘t load AMD 64-bit .dll on a IA 32-bit platform【已解决】
129 0
Error:java: Compilation failed: internal java compiler error 解决办法
Error:java: Compilation failed: internal java compiler error 解决办法
147 0
|
1月前
|
【Java并发】【线程池】带你从0-1入门线程池
欢迎来到我的技术博客!我是一名热爱编程的开发者,梦想是编写高端CRUD应用。2025年我正在沉淀中,博客更新速度加快,期待与你一起成长。 线程池是一种复用线程资源的机制,通过预先创建一定数量的线程并管理其生命周期,避免频繁创建/销毁线程带来的性能开销。它解决了线程创建成本高、资源耗尽风险、响应速度慢和任务执行缺乏管理等问题。
166 60
【Java并发】【线程池】带你从0-1入门线程池
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等