国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

spring入門第一坑,解決報(bào)錯(cuò)class path resource [spring.xml] cannot be opened because it does not exist......

這篇具有很好參考價(jià)值的文章主要介紹了spring入門第一坑,解決報(bào)錯(cuò)class path resource [spring.xml] cannot be opened because it does not exist......。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

下面這幾行代碼大家應(yīng)該都很熟悉,就是 Spring 的 "Hello World"。

spring入門第一坑,解決報(bào)錯(cuò)class path resource [spring.xml] cannot be opened because it does not exist......

?那么我們?cè)谶\(yùn)行這個(gè) main方法可能會(huì)遇到【報(bào)錯(cuò)】:Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring.xml] cannot be opened because it does not exist......就像這樣:

spring入門第一坑,解決報(bào)錯(cuò)class path resource [spring.xml] cannot be opened because it does not exist......

大概意思就是沒有找到 spring.xml 這個(gè)配置文件,仔細(xì)看 spring.xml 是在 resource 目錄下,貌似是沒啥問題

spring入門第一坑,解決報(bào)錯(cuò)class path resource [spring.xml] cannot be opened because it does not exist......

再展開看下 target 目錄發(fā)現(xiàn)了問題所在,這是因?yàn)樵?Idea 中,編譯器只會(huì)把 src/main/java 也就是源代碼目錄下的 .java 文件編譯成 .class 文件然后放到 target 目錄中,其他的默認(rèn)不會(huì)。

spring入門第一坑,解決報(bào)錯(cuò)class path resource [spring.xml] cannot be opened because it does not exist......

?這里我們只需要將 spring.xml 文件復(fù)制到 target/classes/ 下即可解決

spring入門第一坑,解決報(bào)錯(cuò)class path resource [spring.xml] cannot be opened because it does not exist......

然后再運(yùn)行試一下,OK啦。

spring入門第一坑,解決報(bào)錯(cuò)class path resource [spring.xml] cannot be opened because it does not exist......文章來源地址http://www.zghlxwxcb.cn/news/detail-503992.html

到了這里,關(guān)于spring入門第一坑,解決報(bào)錯(cuò)class path resource [spring.xml] cannot be opened because it does not exist......的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 解決Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource

    解決Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource

    Error creating bean with name \\\'sqlSessionFactory\\\' defined in class path resource 出錯(cuò)背景:項(xiàng)目中使用mybatisplus開發(fā),涉及到了xml文件,現(xiàn)在需要下線個(gè)功能,所以就先把相關(guān)的代碼注釋掉了,但是在啟動(dòng)的時(shí)候不知道為什么會(huì)報(bào)這個(gè)錯(cuò):Error creating bean with name \\\'sqlSessionFactory\\\' defined in class pat

    2024年02月11日
    瀏覽(28)
  • The bean‘ dataSource‘, defined in class path resource具體錯(cuò)誤在下面和解決辦法

    The bean‘ dataSource‘, defined in class path resource具體錯(cuò)誤在下面和解決辦法

    報(bào)錯(cuò)信息表明,在聲明 org.apache.shardingsphere.shardingjdbc.spring.boot 包下的 SpringBootConfiguration中的dataSource這個(gè)bean時(shí)出錯(cuò), 原因是有一個(gè)同名的 dataSource 的bean在com.alibaba.druid.spring.boot.autoconfigure包下的DruidDataSourceAutoConfigure類加載時(shí)已經(jīng)聲明了。 而我們需要用到的是 shardingjdbc包下的

    2024年02月15日
    瀏覽(21)
  • Error creating bean with name ‘kafkaTemplate‘ defined in class path resource

    Error creating bean with name ‘kafkaTemplate‘ defined in class path resource

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name \\\'org.springframework.boot.autoconfigure.kafka.KafkaAnnotationDrivenConfiguration\\\': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.kafka.Kafka

    2024年02月07日
    瀏覽(30)
  • Caused by: java.io.FileNotFoundException: class path resource [datasourc.properties] cannot be opene

    Caused by: java.io.FileNotFoundException: class path resource [datasourc.properties] cannot be opene

    異常: Caused by: java.io.FileNotFoundException: class path resource [文件名] cannot be opened because it does not exist 原因: 資源無法打開,因?yàn)樗淮嬖?在Maven項(xiàng)目里面資源 默認(rèn)生成的類路徑是src/main/java ,如果你所需要的文件不在這個(gè)目錄下,項(xiàng)目編譯器輸出里就不會(huì)有該文件(即便你的項(xiàng)目

    2024年02月07日
    瀏覽(27)
  • springboot如何訪問resource目錄下的文件,訪問不到資源處理方法:class path resource [template.xlsx] cannot be resolved to UR

    class path resource [template.xlsx] cannot be resolved to UR ClassPathResource 可以直接訪問到資源文件夾reource,但是為什么提示找不到資源呢,首先我先放出我得代碼 示例代碼 訪問不到資源處理方法: 報(bào)錯(cuò):class path resource [template.xlsx] cannot be resolved to UR 于是我檢查target文件是否存在編譯后

    2024年02月09日
    瀏覽(17)
  • Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource [application-config

    Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource [application-config

    學(xué)習(xí)spring框架時(shí)遇到一個(gè)問題。 記錄一個(gè)錯(cuò)誤: ? 摘出最主要的提示: 主要問題Error creating bean with name \\\'sqlSessionFactory\\\' defined in class path resource [applicationContext.xml]: Invocation of init method failed;在創(chuàng)建bean時(shí),調(diào)用初始化方法失敗。從而引出后面集中嵌套的錯(cuò)誤。 定位到最終代碼

    2024年02月06日
    瀏覽(28)
  • An error happened during template parsing (template: "class path resource [templates/user.html]")問題解...

    An error happened during template parsing (template: "class path resource [templates/user.html]")問題解...

    問題: An error happened during template parsing (template: \\\"class path resource [templates/user.html]\\\") ?解決方法: 1.配置文件問題。根據(jù)問題描述,問題可能為想要去的地址路徑錯(cuò)誤。解決方法:修改路徑。 ? ?2.@RestController @RestController相當(dāng)于@Response + @Controller,作用是將return的字符串響應(yīng)在界

    2024年02月16日
    瀏覽(18)
  • Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed;

    更新更高版本的SpringBoot依賴解決了 來自GitHub上面的GitHub - echisan/springboot-jwt-demo: 這是一個(gè)使用了springboot+springSecurity+jwt實(shí)現(xiàn)的基于token的權(quán)限管理的一個(gè)demo項(xiàng)目,本地啟動(dòng)后報(bào)錯(cuò) 完整報(bào)錯(cuò)信息如下 提示信息里有 Hibernate 應(yīng)該和數(shù)據(jù)庫(kù)持久層框架有關(guān),項(xiàng)目用的是 jpa ,底層是

    2024年02月15日
    瀏覽(20)
  • 解決問題:Class path contains multiple SLF4J bindings.

    解決問題:Class path contains multiple SLF4J bindings.

    最近在整合SpringBoot項(xiàng)目于Dubbo的時(shí)候,遇到Class path contains multiple SLF4J bindings的錯(cuò)誤,具體報(bào)錯(cuò)如下所示: 讀取報(bào)錯(cuò)信息可以知道,問題出在我們的jar出現(xiàn)了沖突! 對(duì)于此類問題,我們可以插件Maven Helper快速定位解決!當(dāng)然也可以在模塊的依賴圖中手動(dòng)排錯(cuò)! 使用Maven Helpe

    2024年02月17日
    瀏覽(23)
  • Class path contains multiple SLF4J bindings.問題原因及解決方案

    問題背景 在進(jìn)行l(wèi)ogback的日志輸出測(cè)試時(shí),顯示如下錯(cuò)誤 2、原因 根據(jù)上面的錯(cuò)誤提示,存在多個(gè)SLF4J bindings綁定,即存在多個(gè)slf4j的實(shí)現(xiàn)類,按上圖所示這兩個(gè)實(shí)現(xiàn)分別是 logback-classic-1.2.6和slf4j-log4j12-1.6.1 ,我們需要的是logback而不是log4j, 3、解決方案 因此,我們?nèi)サ鬺og4j的

    2024年02月11日
    瀏覽(22)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包