spring 读取gradle 属性
作者:
疯狂的冰块 | 来源:发表于
2018-02-25 16:08 被阅读49次
在spring boot 配置中如何读取到gradel的属性呢?
首先需要暴露属性:
build.gradle
processResources {
expand(project.properties)
}
然后在
application.properties里配置如下
${var} 这种格式便可以读取到gradle配置。
spring.profiles.active=${env}
#log
logging.config=classpath:log4j2-${env}.xml
参考资料:
https://qbgbook.gitbooks.io/spring-boot-reference-guide-zh/IX.%20%E2%80%98How-to%E2%80%99%20guides/69.1.2.%20Automatic%20property%20expansion%20using%20Gradle.html
本文标题:spring 读取gradle 属性
本文链接:https://www.haomeiwen.com/subject/xqprxftx.html
网友评论