日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網(wǎng)站首頁 編程語言 正文

SpringBoot 項目啟動報錯 Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded

作者:NGU7180 更新時間: 2024-03-08 編程語言

在初始化springboot項目的時候,啟動一個test測試的時候,成功遇到了這個錯誤,

當時我的application.yml配置是未被注釋的這個.

然后我采取了以下步驟,

  1. 將上面報錯的配置改為下面的
  2. 修改配置文件名稱從application.yml到application.properties
  3. 根據(jù)一宿君的文章,在<build>標簽下添加了<resources>標簽,引入了該文件,注意一定要放在build標簽下,否則會報錯
    <!-- 如果不添加此節(jié)點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>
    

    至此,測試成功運行通過,

原文鏈接:https://blog.csdn.net/NGU7180/article/details/136404394

  • 上一篇:沒有了
  • 下一篇:沒有了
欄目分類
最近更新