最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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 基礎(chǔ)語法讓你弄懂類和對(duì)象

    Java 基礎(chǔ)語法讓你弄懂類和對(duì)象

    C 語言是面向過程的,而 Java 是面向?qū)ο笫俏覀兂B牭降囊痪湓?,這章將帶你揭曉Java 基礎(chǔ)語法中類與對(duì)象到底是什么,需要的朋友請(qǐng)參考下文
    2021-08-08
  • Java設(shè)計(jì)模式之java組合模式詳解

    Java設(shè)計(jì)模式之java組合模式詳解

    這篇文章主要介紹了JAVA設(shè)計(jì)模式之組合模式,簡單說明了組合模式的原理,并結(jié)合實(shí)例分析了java組合模式的具體用法,需要的朋友可以參考下
    2021-09-09
  • Java 并發(fā)編程學(xué)習(xí)筆記之Synchronized底層優(yōu)化

    Java 并發(fā)編程學(xué)習(xí)筆記之Synchronized底層優(yōu)化

    這篇文章主要介紹了Java 并發(fā)編程學(xué)習(xí)筆記之Synchronized底層優(yōu)化的相關(guān)資料,主要包含了重量級(jí)鎖,輕量級(jí)鎖,偏向鎖和其他優(yōu)化等方面,有需要的小伙伴可以參考下
    2016-05-05
  • JAVA GUI自定義JPanel畫板背景

    JAVA GUI自定義JPanel畫板背景

    這篇文章主要為大家詳細(xì)介紹了JAVA GUI自定義JPanel畫板背景的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-12-12
  • Spring框架讀取property屬性文件常用5種方法

    Spring框架讀取property屬性文件常用5種方法

    這篇文章主要介紹了Spring框架讀取property屬性文件常用5種方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-09-09
  • 詳解Java設(shè)計(jì)模式之單例模式

    詳解Java設(shè)計(jì)模式之單例模式

    單例模式是一種創(chuàng)建型設(shè)計(jì)模式,它的目的是確保一個(gè)類只有一個(gè)實(shí)例,并提供一個(gè)全局訪問點(diǎn)來訪問該實(shí)例,在單例模式中,類自身負(fù)責(zé)創(chuàng)建自己的唯一實(shí)例,并確保在系統(tǒng)中只有一個(gè)實(shí)例存在,本文詳細(xì)介紹了Java設(shè)計(jì)模式中的單例模式,感興趣的同學(xué)可以參考閱讀
    2023-05-05
  • JAVA實(shí)現(xiàn)監(jiān)測(cè)tomcat是否宕機(jī)及控制重啟的方法

    JAVA實(shí)現(xiàn)監(jiān)測(cè)tomcat是否宕機(jī)及控制重啟的方法

    這篇文章主要介紹了JAVA實(shí)現(xiàn)監(jiān)測(cè)tomcat是否宕機(jī)及控制重啟的方法,可實(shí)現(xiàn)有效的檢測(cè)及控制tomcat服務(wù)器運(yùn)行,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-08-08
  • 使用idea的database模塊繪制數(shù)據(jù)庫er圖的方法

    使用idea的database模塊繪制數(shù)據(jù)庫er圖的方法

    這篇文章主要介紹了使用idea的database模塊繪制數(shù)據(jù)庫er圖,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-07-07
  • mybatis判斷int是否為空的時(shí)候,需要注意的3點(diǎn)

    mybatis判斷int是否為空的時(shí)候,需要注意的3點(diǎn)

    這篇文章主要介紹了mybatis判斷int是否為空的時(shí)候,需要注意的3點(diǎn),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-07-07
  • 一篇文章帶你搞定JAVA注解

    一篇文章帶你搞定JAVA注解

    這篇文章主要介紹了詳解Java注解的實(shí)現(xiàn)與使用方法的相關(guān)資料,希望通過本文大家能夠理解掌握J(rèn)ava注解的知識(shí),需要的朋友可以參考下
    2021-07-07

最新評(píng)論

什邡市| 汉源县| 宁南县| 邵东县| 舒兰市| 柳州市| 鹤庆县| 濮阳市| 丹凤县| 徐水县| 灵石县| 顺昌县| 安宁市| 礼泉县| 八宿县| 阿勒泰市| 大庆市| 宝山区| 泰来县| 南通市| 浙江省| 台湾省| 留坝县| 思茅市| 大渡口区| 黑河市| 峨山| 南郑县| 张家港市| 措勤县| 永修县| 天津市| 龙里县| 三明市| 高邑县| 桃源县| 常熟市| 武陟县| 华宁县| 穆棱市| 清新县|