配置文件读取核心pom中的属性值流程

核心pom:

<!--定义该工程用于进行构建管理-->
<packaging>pom</packaging>

<!--定义自定义属性-->
<properties>
  <jdbc.url>jdbc:mysql://127.0.0.1:3306/xx_db</jdbc.url>
</properties>

......

<build>
  <!--配置资源文件对应的信息-->
  <resources>
      <resource>
      <directory>${project.basedir}/src/main/resources</directory>
          <filtering>true</filtering>
      </resource>
  </resources>
</build>

配置文件application.Properties:

jdbc.url=${jdbc.url}

maven打包成jar包后,打开jar包即可看到配置文件已读取指定属性值;

以上;

posted @ 2022-09-17 23:17  丙炎  阅读(59)  评论(0)    收藏  举报