Using Expressions in Spring application.properties file

前端 未结 3 2219
梦毁少年i
梦毁少年i 2020-12-06 18:32

Can expressions be used as a right-hand-side value in a Spring application.properties file?

For example, something like this:

logging.level.com.acme=         


        
3条回答
  •  渐次进展
    2020-12-06 19:09

    Use profile based properties file.

    In application-dev.properties : logging.level.com.acme=WARN

    and in application-prod.properties : logging.level.com.acme=DEBUG

    FYI when spring boot doesn't find a propertie in a profile based file it use the value in the default one . So you can set properties in application.properties and override them in a profile based file when their value changed.

提交回复
热议问题