解决If you want an embedded database (H2, HSQL or Derby)...application.yml加载失败问题

发布时间:2024年01月15日

问题报错如上:

试了网上很多解决方案都无法解决,大多都是配置文件未打包,解决方案都是改资源打包规则,方法有很多,如:

<build>
    <!--idea  识别.xml  指定资源的位置-->
    <resources>
      <resource>
        <directory>src/main/java</directory><!--所在目录-->
        <includes>
          <include>**/*.properties</include>
          <include>**/*.xml</include>
        </includes>
        <filtering>false</filtering>
      </resource>
      <resource>
        <directory>src/main/resources</directory><!--所在目录-->
        <includes>
          <include>**/*.yml</include>
          <include>**/*.xml</include>
        </includes>
        <filtering>false</filtering>
      </resource>
    </resources>
  </build>

亦或者改变打包方式

<packaging>pom</packaging>
<!--改为jar包-->
<packaging>jar</packaging>

解决方案:

		<resources>
            <resource>
                <directory>${basedir}/src/main/java</directory>
                <includes>
                    <include>**/*.*</include>
                </includes>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
                <includes>
                    <include>**/*.*</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>

文章来源:https://blog.csdn.net/weixin_51743499/article/details/135591303
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。