Open jajimene opened 6 years ago
We've created several xxx.properties files for different environments and tried to add them using the spring.profiles.active as stated in DXA's documentation. However, although the profile is properly picked up, the properties file is being ignored.
xxx.properties
spring.profiles.active
I debugged the DxaSpringInitialization class that defines the required beans for DXA, and found the first one is loading all the dxa.*.properties file by using the following method: https://github.com/sdl/dxa-web-application-java/blob/51b8cdee1ad683d1ca778d5e465b3f4ab83bbe9f/dxa-framework/dxa-common-api/src/main/java/com/sdl/dxa/DxaSpringInitialization.java#L60
DxaSpringInitialization
dxa.*.properties
The Javadoc for the method configurer.setPropertySources(propertySources); says:
configurer.setPropertySources(propertySources);
Setting this property indicates that environment property sources and local properties should be ignored.
I suspect defining the placeholderConfigurer bean that way causes DXA to ignore any .properties file not included in https://github.com/sdl/dxa-web-application-java/blob/1610c7be29c038ffebf340bb8c44c5046de607cf/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/util/InitializationUtils.java#L104
placeholderConfigurer
.properties
It also causes the application to ignore any inline property you try to set during execution, like:
java -jar MyDxaApp-bootified.jar --server.port=8081
See also: https://tridion.stackexchange.com/questions/18792/dxa-java-web-application-profile-specific-properties
We've created several
xxx.properties
files for different environments and tried to add them using thespring.profiles.active
as stated in DXA's documentation. However, although the profile is properly picked up, the properties file is being ignored.I debugged the
DxaSpringInitialization
class that defines the required beans for DXA, and found the first one is loading all thedxa.*.properties
file by using the following method: https://github.com/sdl/dxa-web-application-java/blob/51b8cdee1ad683d1ca778d5e465b3f4ab83bbe9f/dxa-framework/dxa-common-api/src/main/java/com/sdl/dxa/DxaSpringInitialization.java#L60The Javadoc for the method
configurer.setPropertySources(propertySources);
says:I suspect defining the
placeholderConfigurer
bean that way causes DXA to ignore any.properties
file not included in https://github.com/sdl/dxa-web-application-java/blob/1610c7be29c038ffebf340bb8c44c5046de607cf/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/util/InitializationUtils.java#L104It also causes the application to ignore any inline property you try to set during execution, like:
See also: https://tridion.stackexchange.com/questions/18792/dxa-java-web-application-profile-specific-properties