dxa-web-application-java icon indicating copy to clipboard operation
dxa-web-application-java copied to clipboard

Local and inline properties being ignored

Open jajimene opened this issue 7 years ago • 0 comments

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.

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

The Javadoc for the method configurer.setPropertySources(propertySources); says:

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

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

jajimene avatar May 03 '18 10:05 jajimene