【发布时间】:2021-05-15 05:28:22
【问题描述】:
application.properties:
app.profile=${spring.profiles.active} spring.profiles.active=dev
service.endpoint=${${spring.profiles.active}.service.endpoint} service.api.user=${${spring.profiles.active}.service.api.user}
开发
dev.service.endpoint = https://test.google.com/
dev.service.api.user = /api/v1/user
产品
prod.service.endpoint = https://google.com/
prod.service.api.user = /api/v1/user
有没有办法通过删除两个环境中的 common which 在这种情况下为 service.api.user 的值来进一步优化 以便其余值转到默认配置文件。
【问题讨论】:
标签: java spring spring-boot configuration