zoukankan      html  css  js  c++  java
  • properties,yml 文件读取 pom.xml 文件变量

    pom.xml 文件配置内容:

    <profiles>
            <profile>
                <id>dev</id>
                <properties>
                    <activatedProperties>dev</activatedProperties>
                </properties>
                   <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
            </profile>
            <profile>
                <id>test</id>
                <properties>
                    <activatedProperties>test</activatedProperties>
                </properties>
            </profile>
            <profile>
                <id>prod</id>
                <properties>
                    <activatedProperties>prod</activatedProperties>
                </properties>
            </profile>
        </profiles>

    yml配置文件读取pom.xml文件中的变量 

    '@activatedProperties@' 就可以动态读取.xml中激活的配置文件级别

    spring:
      application:
        name: sky-ads-marketing
      mvc:
        throw-exception-if-no-handler-found: true
      resources:
        add-mappings: false
      profiles:
        active: '@activatedProperties@'

    properties配置文件读取pom.xml文件中的变量 跟上面yml读取一样

    @activatedProperties@ 这样就可以读取到了

    #配置总开关
    dep=@activatedProperties@
     
    # 调度中心部署跟地址 [选填]:如调度中心集群部署存在多个地址则用逗号分隔。
    # 执行器将会使用该地址进行"执行器心跳注册""任务结果回调";为空则关闭自动注册;
    dev.addresses=https://127.0.0.1:8080/xxl-job-admin
    test.addresses=https://127.0.0.1:8080/xxl-job-admin
    prod.addresses=https://127.0.0.1:8080/xxl-job-admin
     
    xxljob.admin_addresses=${${dep}.addresses}

    properties 配置文件读取自己内部的变量用:

    ${变量名称}

    就可以读取到本身内部定义的变量。

  • 相关阅读:
    解决-webkit-box-orient: vertical;(文本溢出)属性在webpack打包后无法编译的问题
    消息框尖尖
    表单提交
    昨天看了一个大神的fix类,清晰了然
    使用cross-env解决跨平台设置NODE_ENV的问题
    axios 在Vue全局引入的方法
    vue自定义指令
    AMD/CMD/CommonJs到底是什么?它们有什么区别?
    artDialog.js的使用
    delegate-使用笔记
  • 原文地址:https://www.cnblogs.com/47Gamer/p/15812771.html
Copyright © 2011-2022 走看看