通过maven动态配置spring boot配置文件

Posted 挎木剑的游侠儿

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了通过maven动态配置spring boot配置文件相关的知识,希望对你有一定的参考价值。

一、引入maven插件的jar包 

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>${maven-resources.version}</version>
</plugin>

二、在配置文件种用变量替换配置属性

三、在pom文件用使用properties添加变量的临时值,一般指用于开发环境的配置属性

四、在打包时,通过maven变量替换pom文件种的配置文件属性值

mvn clean -Dmaven.test.skip=true -Dregister.value=${NACOS_ADRESS} deploy

以上是关于通过maven动态配置spring boot配置文件的主要内容,如果未能解决你的问题,请参考以下文章