欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

SpringBoot項(xiàng)目報(bào)錯(cuò):"Error?starting?ApplicationContext...."解決辦法

 更新時(shí)間:2022年08月16日 15:41:40   作者:牛·云說  
這篇文章主要給大家介紹了關(guān)于SpringBoot項(xiàng)目報(bào)錯(cuò):“Error?starting?ApplicationContext.?To?display?the?conditions?report?re-run?...”的解決辦法,文中通過圖文介紹的非常詳細(xì),需要的朋友可以參考下

發(fā)現(xiàn)錯(cuò)誤

SpringBoot項(xiàng)目報(bào)錯(cuò):

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

以下方案80%可以幫助您解決這些個(gè)‘可惡的’問題

報(bào)錯(cuò)內(nèi)容和截圖如下:

Connected to the target VM, address: '127.0.0.1:4963', transport: 'socket'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v2.3.10.RELEASE)

2021-12-25 14:52:41.578  INFO 13204 --- [           main] m.c.DiitMicrosoftserviceCheckApplication : Starting DiitMicrosoftserviceCheckApplication on 老云的計(jì)算機(jī) with PID 13204 (D:\svn\workspace_nxzrbhdzt\Gh_yizhangtu\dit-check\target\classes started by liuyundashen in D:\svn\workspace_nxzrbhdzt\Gh_yizhangtu\dit-check)
2021-12-25 14:52:41.583  INFO 13204 --- [           main] m.c.DiitMicrosoftserviceCheckApplication : No active profile set, falling back to default profiles: default
2021-12-25 14:52:43.485  INFO 13204 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-12-25 14:52:43.503  INFO 13204 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-12-25 14:52:43.504  INFO 13204 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.45]
2021-12-25 14:52:43.668  INFO 13204 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-12-25 14:52:43.668  INFO 13204 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1979 ms
2021-12-25 14:52:43.832  INFO 13204 --- [           main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2021-12-25 14:52:43.910 ERROR 13204 --- [           main] com.alibaba.druid.pool.DruidDataSource   : testWhileIdle is true, validationQuery not set
2021-12-25 14:52:43.917  INFO 13204 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} inited
 _ _   |_  _ _|_. ___ _ |    _ 
| | |\/|_)(_| | |_\  |_)||_|_\ 
     /               |         
                        3.2.0 
2021-12-25 14:52:44.365  WARN 13204 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cheakRecordController': Unsatisfied dependency expressed through field 'recordService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'TRecordServiceImpl': Unsatisfied dependency expressed through field 'packageService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resultPackageBaseinfoServiceImpl': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'importDB.datasource.url' in value "${importDB.datasource.url}"
2021-12-25 14:52:44.366  INFO 13204 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closing ...
2021-12-25 14:52:44.368  INFO 13204 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closed
2021-12-25 14:52:44.372  INFO 13204 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2021-12-25 14:52:44.391  INFO 13204 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-12-25 14:52:44.410 ERROR 13204 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cheakRecordController': Unsatisfied dependency expressed through field 'recordService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'TRecordServiceImpl': Unsatisfied dependency expressed through field 'packageService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resultPackageBaseinfoServiceImpl': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'importDB.datasource.url' in value "${importDB.datasource.url}"
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1425) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.14.RELEASE.jar:5.2.14.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[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]

——在看到這些個(gè)問題的時(shí)候,日志基本都會(huì)告訴你錯(cuò)誤的地方,所以我們大部分可以根據(jù)日志報(bào)錯(cuò)的信息分析錯(cuò)誤的原因:

一、編譯出問題

仔細(xì)看報(bào)出的問題,有沒有如:“Description:…” 這樣的字眼,沒有 “描述”,如上圖所示,這種情況下的操作:
1.clean清理一下; 2.然后install重新編譯一下 ;

3.也可以用這個(gè)命令,重新編譯一下

這個(gè)時(shí)候重新啟動(dòng),如果還是報(bào)同樣的錯(cuò)誤,打開如下圖位置,看是否有編譯的文件,如mapper.xml文件,application.yml或者application.properties文件,以及一些配置文件等

——哎!生氣,這里發(fā)現(xiàn)真的沒有mapper和配置文件,只有main下面的.jar文件,該怎么辦呢?

——pom.xml文件中給加入要編譯的文件位置依賴,如下:(這是我的文件位置,你根據(jù)你的進(jìn)行調(diào)整)

<!--引入本地資源-->
        <resources>
            <!--加載lib文件,特殊情況下會(huì)有l(wèi)ib,但大部分都靠依賴下載了-->
            <resource>
                <directory>lib</directory>
                <targetPath>BOOT-INF/lib/</targetPath>
                <includes>
                    <include>**/*.jar</include>
                </includes>
            </resource>
            <!--打jar包-->
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
            </resource>
            <!--將properties和xml文件編譯-->
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>

好的,清理——>打包——>啟動(dòng)——>運(yùn)行成功,搞定收工

二、請(qǐng)求接口重復(fù)

根據(jù)日志看出它說路徑問題;這樣想你寫的接口名字是否重復(fù),只有一個(gè)斜杠或者沒斜杠的情況

如下截圖:

修改如下:

好的,重新啟動(dòng),搞定收工

三、加@Mapper注解

這些情況就是看描述的問題

如圖:

這種情況,看是不是沒有掃描到它需要的東西,給加上@Mapper注解(是掃描dao層的),或者 加上@Service注解(掃描service層)即可。

四、加@SpringBootApplication注解,數(shù)據(jù)庫問題

根據(jù)問題看出:springboot啟動(dòng)時(shí)會(huì)自動(dòng)注入數(shù)據(jù)源和配置jpa ,解決:

在@SpringBootApplication中排除其注入

@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})

五、端口重復(fù)問題

查看是否自己的運(yùn)行端口沖突,將其kill殺死,重新啟動(dòng),或者跟換端口

以下是查看端口沖突的方式:

window鍵+R,輸入“netstat -aon|findstr 8080”找到占用8080端口的進(jìn)程號(hào):

2.輸入“tasklist|findstr “3412” ”:

查看進(jìn)程號(hào)為“3412”的進(jìn)程:

3.輸入“taskkill /f /t /im QQ.exe”:(/f:強(qiáng)制性的結(jié)束進(jìn)程)

結(jié)束這個(gè)進(jìn)程

現(xiàn)在可以重新啟動(dòng)一下,看是否運(yùn)行成功

六、包沖突

還有的情況可能是包沖突了,可以將maven倉庫清理一下自己的包,重新下載一下

總結(jié)

到此這篇關(guān)于SpringBoot項(xiàng)目報(bào)錯(cuò):"Error starting ApplicationContext...."解決辦法的文章就介紹到這了,更多相關(guān)SpringBoot項(xiàng)目報(bào)錯(cuò)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Java數(shù)組隊(duì)列概念與用法實(shí)例分析

    Java數(shù)組隊(duì)列概念與用法實(shí)例分析

    這篇文章主要介紹了Java數(shù)組隊(duì)列概念與用法,結(jié)合實(shí)例形式分析了Java數(shù)組隊(duì)列相關(guān)概念、原理、用法及操作注意事項(xiàng),需要的朋友可以參考下
    2020-03-03
  • Java反轉(zhuǎn)字符串和相關(guān)字符編碼的問題解決

    Java反轉(zhuǎn)字符串和相關(guān)字符編碼的問題解決

    反轉(zhuǎn)字符串一直被當(dāng)作是簡(jiǎn)單問題,大家的思想主要就是利用遍歷,首尾交換字符實(shí)現(xiàn)字符串的反轉(zhuǎn)。例如下面的代碼,就可以簡(jiǎn)單實(shí)現(xiàn)反轉(zhuǎn)。
    2013-05-05
  • Java中常見的查找算法與排序算法總結(jié)

    Java中常見的查找算法與排序算法總結(jié)

    數(shù)據(jù)結(jié)構(gòu)是數(shù)據(jù)存儲(chǔ)的方式,算法是數(shù)據(jù)計(jì)算的方式。所以在開發(fā)中,算法和數(shù)據(jù)結(jié)構(gòu)息息相關(guān)。本文為大家整理了Java中常見的查找與排序算法的實(shí)現(xiàn),需要的可以參考一下
    2023-03-03
  • web.xml中servlet, bean, filter, listenr 加載順序_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    web.xml中servlet, bean, filter, listenr 加載順序_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    這篇文章主要介紹了web.xml中servlet, bean, filter, listenr 加載順序,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-08-08
  • Java實(shí)現(xiàn)按鍵精靈的示例代碼

    Java實(shí)現(xiàn)按鍵精靈的示例代碼

    這篇文章主要為大家詳細(xì)介紹了如何利用Java語言實(shí)現(xiàn)按鍵精靈,文中的示例代碼講解詳細(xì),對(duì)我們學(xué)習(xí)或工作有一定的參考價(jià)值,感興趣的可以學(xué)習(xí)一下
    2022-05-05
  • SpringBoot實(shí)現(xiàn)發(fā)送電子郵件

    SpringBoot實(shí)現(xiàn)發(fā)送電子郵件

    這篇文章主要介紹了SpringBoot實(shí)現(xiàn)發(fā)送電子郵件,電子郵件是—種用電子手段提供信息交換的通信方式,是互聯(lián)網(wǎng)應(yīng)用最廣的服務(wù)。通過網(wǎng)絡(luò)的電子郵件系統(tǒng),用戶可以非??焖俚姆绞?,與世界上任何一個(gè)角落的網(wǎng)絡(luò)用戶聯(lián)系,下面就來看看SpringBoot如何實(shí)現(xiàn)發(fā)送電子郵件吧
    2022-01-01
  • Springboot居然可以設(shè)置動(dòng)態(tài)的Banner(推薦)

    Springboot居然可以設(shè)置動(dòng)態(tài)的Banner(推薦)

    這篇文章主要介紹了Springboot居然可以設(shè)置動(dòng)態(tài)的Banner,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-03-03
  • Swagger2配置Security授權(quán)認(rèn)證全過程

    Swagger2配置Security授權(quán)認(rèn)證全過程

    這篇文章主要介紹了Swagger2配置Security授權(quán)認(rèn)證全過程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-03-03
  • 基于synchronized修飾靜態(tài)和非靜態(tài)方法

    基于synchronized修飾靜態(tài)和非靜態(tài)方法

    這篇文章主要介紹了基于synchronized修飾靜態(tài)和非靜態(tài)方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-04-04
  • SpringBoot利用AOP實(shí)現(xiàn)一個(gè)日志管理詳解

    SpringBoot利用AOP實(shí)現(xiàn)一個(gè)日志管理詳解

    目前有這么個(gè)問題,有兩個(gè)系統(tǒng)CSP和OMS,這倆系統(tǒng)共用的是同一套日志操作:Log;目前想?yún)^(qū)分下這倆系統(tǒng)的日志操作,那沒辦法了,只能重寫一份Log的日志操作。本文就將利用AOP實(shí)現(xiàn)一個(gè)日志管理,需要的可以參考一下
    2022-09-09

最新評(píng)論