SpringBoot2.X启动报错Could not resolve placeholder 'xxl.job.admin.address'

SpringBoot2.X启动报错Could not resolve placeholder 'xxl.job.admin.address'

  • 解决思路

解决思路

想单独构建一个工程,依赖xxl-job的核心包做一个JOB任务服务,并且需要支持分环境打包,application.yml中配置为:
profiles:
active: @profileActive@
SpringBoot2.X启动报错Could not resolve placeholder 'xxl.job.admin.address'_第1张图片
同时pom.xml文件中,标签下添加如下配置代码:

<build>
<finalName>${artifactId}</finalName>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <excludes>
                    <exclude>application-prod.yml</exclude>
                    <exclude>application-dev.yml</exclude>
                    <exclude>application-test.yml</exclude>
                </excludes>
            </resource>
            <!--需要动态添加的资源-->
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <!--读取打包命令中指定的环境-->
                    <include>application-${profileActive}.yml</include>
                    <include>application.yml</include>
                </includes>
            </resource>
        </resources>
  </build>

== 再次启动,结果还是报错!!!!==

继续在pom.xml文件中新增配置如下:默认为dev配置文件,可以实现动态分环境打包:

<profiles>
        <profile>
            <id>dev</id>
            <properties>
                <profileActive>dev</profileActive>
            </properties>
            <activation>
                <!--指定默认激活-->
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>test</id>
            <properties>
                <profileActive>test</profileActive>
            </properties>
        </profile>
        <profile>
            <id>prod</id>
            <properties>
                <profileActive>prod</profileActive>
            </properties>
        </profile>
    </profiles>

你可能感兴趣的:(SpringBoot2.x学习,Springboot,resolve,placeholder,分环境打包,profileActive)