parent properties for application-{profile}.properties with Spring-Boot app -


there common properties shared among different profiles e.g. path location temp files , path remains same among different env(tst,prd).

is there way have parent application-{parent}.properties profile specific properties files can inherit properties.

that in avoiding writing same properties in application-{profile}.properties

in addition, each application-{profile}.properties have :

profilelocation=xxx abc=${profilelocation}/temppath 

here can move abc common location? cannot in application.properties gets loaded before application-{profile}.properties

actually, not entirely true application.properties loaded before others. processed together. set common properties used profiles, should use ordinary application.properties file. 2 main thing should know described below.

case 1. keys placed inside application.properties file can overridden profile specific configuration.

common.path.for.all.envs=/some/path default.path=/another/path 

than in e.g. application-dev.properties can override values.

default.path=/dev/path 

at runtime dev profile application have access 2 keys. value of common.path.for.all.envs set /some/path declared in main file , default.path set /dev/path because override property in profile configuration.

case 2. values defines in application.properties file can use placeholders values included in profile configurations. instance, in application.properties define following variable:

abc=${profilelocation}/temppath 

next, in application-dev.properties declare missing variable:

profilelocation=xxx 

then running dev profile value of abc set xxx/temppath. see, variable declared in profile configuration can used in main application.properties file well.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -