Documentation Center

DXA Java configuration

The following changes have been introduced to the DXA Java

  • Spring context and DXA Framework are configured fully using the Java Configuration and property files. No XML for Spring is used in DXA.
  • Default values for services are taken from the existing configuration for such services with a fallback to an option property in dxa*.properties, and possible further fallback to hardcoded value (if possible).
  • This is the order in which DXA imports properties files:
    1. dxa.defaults.properties
    2. dxa.modules.*.properties
    3. dxa.properties
    4. dxa.addons.*.properties

Spring Profiles

Use case:

Different beans are defined across DXA and modules. If a bean is defined in DXA and imported into module, then the latter tends to replace the former if other behavior is not required. For example, in case a module has two implementations of the same bean, the implementation is chosen using a Spring profile. This is the main use case for Spring profiles but others are still possible.

Spring profile nameDescriptionAdditional information
search.aws Activates AWS in SearchNot compatible with search.solr
search.solr Activates SOLR in SearchNot compatible with search.aws
adf.context.provider Activates ADF instead of ContextService in Web8Does not affect SDL Tridion 2013 SP1
51degrees.context.providerActivates 51Degrees Context ProviderRequires dxa-51degrees-module.
dxa.no-cacheMakes DXA use NoCacheProvider in Tridion
testActivates Testing contextOnly affects unit testing. Activated in Tests by default. Does not affect the application.

Spring Profiles is something you must set explicitly for your web application. This is typically done using one of the following:

  • You can use the <init-param> or <context-param> in your web.xml.
    <context-param>
        <param-name>spring.profiles.active</param-name>
        <param-value>search.aws, adf.context.provider</param-value>
    </context-param>
  • You can provide a system parameter at application startup -Dspring.profiles.active="search.aws, adf.context.provider".

In DXA Example web application, if you have <init-param> or <context-param> set, its values have a priority over any other configuration. If you do not have these parameters set, the web application searches for spring.profiles.active and spring.profiles.include in dxa.**.properties files and adds them all to active profiles. This is the preferable way for DXA to configure Spring Profiles.