idea运行maven出现o.s.boot.SpringApplication : Application run failed
起因:在解决别的bug的时候,把“application.properties”重命名为“application.yml”,没有用又改回来了。
结果:
项目不加载 application.properties 配置文件!!!
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-02-27 08:28:28.497 ERROR 11936 --- [ main] o.s.boot.SpringApplication : Application run failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eduChapterController': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.atguigu.eduservice.controller.EduChapterController] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:287) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1286) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1201) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]at com.atguigu.eduservice.EduApplication.main(EduApplication.java:18) [classes/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.atguigu.eduservice.controller.EduChapterController] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:477) ~[spring-core-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:318) ~[spring-core-5.2.1.RELEASE.jar:5.2.1.RELEASE]at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:265) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]... 18 common frames omitted
Caused by: java.lang.NoClassDefFoundError: com/atguigu/commonutils/Rat java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_131]at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_131]at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_131]at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:459) ~[spring-core-5.2.1.RELEASE.jar:5.2.1.RELEASE]... 20 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.atguigu.commonutils.Rat java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_131]at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_131]at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_131]at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_131]... 24 common frames omittedDisconnected from the target VM, address: '127.0.0.1:10210', transport: 'socket'Process finished with exit code 1
解决方式:
参考:SpringBoot 项目不加载 application.properties 配置文件 - 威威超酷 - 博客园 https://www.cnblogs.com/wwct/p/12258984.html
(感谢大佬!)
yml或者properties文件没有被扫描到,需要在pom文件中<build></build>添加如下.来保证文件都能正常被扫描到并且加载成功.
<!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
<resources><resource><directory>src/main/java</directory><includes><include>**/*.yml</include><include>**/*.properties</include><include>**/*.xml</include></includes><filtering>false</filtering></resource><resource><directory>src/main/resources</directory><includes><include>**/*.yml</include><include>**/*.properties</include><include>**/*.xml</include></includes><filtering>false</filtering></resource>
</resources>
idea运行maven出现o.s.boot.SpringApplication : Application run failed相关推荐
- Springboot启动报错[ main] o.s.boot.SpringApplication: Application run failed(佷有可能是版本问题)
前言:本人小白一枚,最近在自学JAVA时遇到了一个小问题,在网上求解无果后,自己找到了原因,这里跟大家分享一下. 开发环境:Win10:IntelliJ IDEA 2021.3.2 版本信息:Java ...
- ERROR 2384 — [ main] o.s.boot.SpringApplication : Application run failed
springboot数据库建表运行后报错: ERROR 2384 - [ main] o.s.boot.SpringApplication : Application run failed org.s ...
- o.s.boot.SpringApplication : Application run failed错误
o.s.boot.SpringApplication : Application run failed错误 问题:springboot启动时加载bean出错,检测一下mybatis的mapper.xm ...
- Springboot启动报错[ main] o.s.boot.SpringApplication: Application run failed
我们编程时很容易出现的错误,有些博客推荐注入 @SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJp ...
- Java 报错 restartedMain] o.s.boot.SpringApplication : Application run failed
其中有一句 findByNo(java.lang.String)! No property no found for type User! Did you mean 'id'? 找不到这个类型的属性 ...
- SpringBoot运行显示Application run failed
错误: Error starting ApplicationContext. To display the conditions report re-run your application with ...
- 使用maven构建的Spring boot项目在开始搭建的时候出的一些错误
首先,先构建一个maven项目,构建好了之后,会有一个错误,先说明一下,我生成maven项目时jre给我自动选择的是1.5版本的,而本人安装的是1.8的 然后,我们要消除这个错误,发现是缺少了一个ja ...
- 通过Maven快速搭建Spring Boot父工程
导入父工程maven依赖 <parent><groupId>org.springframework.boot</groupId><artifactId> ...
- maven打包插件----Spring Boot Maven Plugin
官方文档链接地址:http://docs.spring.io/spring-boot/docs/1.3.0.BUILD-SNAPSHOT/maven-plugin/index.html 第一部分 Sp ...
最新文章
- 《R语言编程艺术》——2.5 使用all()和any()
- c语言怎么往栈中输入元素,C语言栈操作
- div中直接绑定富文本值
- Delphi的文件操作
- Win03+IIS6 部署.NetFramework4(ASP.NET4)的一点小经验
- Android 网络请求(OKHttp框架)
- 初学者-C语言基础练习(二)——C语言编译器的使用方法
- linux journalctl使用详解
- GIS和RS数据查找下载网址整合
- DTCMS添加栏目教程
- yy安全中心官网首页登录html,YY安全中心手机版
- 运行Android Studio,一直提示:Error running app: Instant Run requires 'Tools | Android | Enable ADB integrat
- ae制h5文字动画_html5酷炫的文字打字动画特效
- 使用TIM捕获测量PWM频率和占空比
- SpringSecurity:登录
- 常用的分类问题中的损失函数
- 乘车码连不上系统服务器,支付宝乘车码无法开通的原因及开通步骤详解
- JavaWeb博客系统
- 北工大计算机网络95分复习——【第一章 引言】
- 易源数据_易源数据-商品条码查询【最新版】_商业智能_数据API_数据应用-云市场-阿里云...
热门文章
- Windows NT Backup - 恢复工具 - Windows Vista的迁移工具
- java实例_Java线程方式及实例
- 计算机专业本科毕业答辩问题及回答
- mysql 数据库dbhelp_策略模式实现支持多种类数据库的DBHelp
- java 链表反转_面试必备 | 不可不会的反转链表
- php微博发布时间,PHP格式化显示时间函数,用于微博、社交媒体等,类似豆瓣
- C语言以数据块的形式读写文件
- mongorepository查询条件_Java操作MongoDB采用MongoRepository仓库进行条件查询 | 学步园...
- plantuml 流程图_画流程图你还在用鼠标拖吗
- Java与数据库 —— JDBC标准