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 配置文件读取自己内部的变量用:
${变量名称}
就可以读取到本身内部定义的变量。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具