日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Error starting ApplicationContext. To display the conditions report re-run your application with ‘de

發布時間:2024/8/1 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Error starting ApplicationContext. To display the conditions report re-run your application with ‘de 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

你遇到的錯誤,可能是如下所示,提示里面多次提示spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE與spring-boot-2.3.10.RELEASE.jar:2.3.10.RELEASE,我們很可能會以為是版本沖突問題,我換了很多版本,結果都不是。

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2021-04-24 12:41:12.026 ERROR 9464 --- [ main] o.s.boot.SpringApplication : Application run failedorg.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [ProductApplication]; nested exception is java.lang.IllegalArgumentException: Could not find class [org.springframework.hateoas.client.LinkDiscoverers]at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:189) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:237) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:280) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.10.RELEASE.jar:2.3.10.RELEASE]at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:755) ~[spring-boot-2.3.10.RELEASE.jar:2.3.10.RELEASE]at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.3.10.RELEASE.jar:2.3.10.RELEASE]at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:402) ~[spring-boot-2.3.10.RELEASE.jar:2.3.10.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.3.10.RELEASE.jar:2.3.10.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1247) ~[spring-boot-2.3.10.RELEASE.jar:2.3.10.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1236) ~[spring-boot-2.3.10.RELEASE.jar:2.3.10.RELEASE]at ProductApplication.main(ProductApplication.java:11) ~[classes/:na] Caused by: java.lang.IllegalArgumentException: Could not find class [org.springframework.hateoas.client.LinkDiscoverers]at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:334) ~[spring-core-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.core.annotation.TypeMappedAnnotation.adapt(TypeMappedAnnotation.java:446) ~[spring-core-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.core.annotation.TypeMappedAnnotation.getValue(TypeMappedAnnotation.java:369) ~[spring-core-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.core.annotation.TypeMappedAnnotation.asMap(TypeMappedAnnotation.java:284) ~[spring-core-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.core.annotation.AbstractMergedAnnotation.asAnnotationAttributes(AbstractMergedAnnotation.java:193) ~[spring-core-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.core.type.AnnotatedTypeMetadata.getAnnotationAttributes(AnnotatedTypeMetadata.java:106) ~[spring-core-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.annotation.AnnotationConfigUtils.attributesFor(AnnotationConfigUtils.java:285) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:102) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:81) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:280) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:296) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:250) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:207) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:175) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]... 14 common frames omitted Caused by: java.lang.ClassNotFoundException: org.springframework.hateoas.client.LinkDiscoverersat java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na]at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]at java.base/java.lang.Class.forName0(Native Method) ~[na:na]at java.base/java.lang.Class.forName(Class.java:398) ~[na:na]at org.springframework.util.ClassUtils.forName(ClassUtils.java:284) ~[spring-core-5.2.14.RELEASE.jar:5.2.14.RELEASE]at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:324) ~[spring-core-5.2.14.RELEASE.jar:5.2.14.RELEASE]... 28 common frames omitted

我們可以看見我自己編寫的ProductApplication下面有紅線錯誤,這是因為我把ProductApplication類寫在java目錄下

原因解析

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2021-04-24 12:41:12.026 ERROR 9464 --- [ main] o.s.boot.SpringApplication : Application run failed

代碼塊之前有個警告提示

** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.

我并沒有使用@ComponentScanning注解,這里為什么會蹦出個這樣的注解呢?
SpringBoot在編寫啟動類(Main方法所在的類)的時候如果不使用@ComponentScan指明對象掃描范圍,默認指掃描當前啟動類所在的包里的對象。
(注意:我在編寫Main方法的時候并沒有加@ComponentScan注解,因而,他會掃描Application所在的包里的對象)
如果當前啟動類沒有包,則在啟動時會報錯:Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package錯誤。
(注意:寫在java文件夾下的Application類,是不從屬于任何一個包的,因而啟動類沒有包)

解決辦法

方法一、將Application建在其他的包下面
方法二、在Application類上面加@ComponentScan注解,指定要掃描的包

問題就解決了

總結

以上是生活随笔為你收集整理的Error starting ApplicationContext. To display the conditions report re-run your application with ‘de的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。