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:
- dxa.defaults.properties
- dxa.modules.*.properties
- dxa.properties
- 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 name | Description | Additional information |
|---|---|---|
| search.aws | Activates AWS in Search | Not compatible with search.solr |
| search.solr | Activates SOLR in Search | Not compatible with search.aws |
| adf.context.provider | Activates ADF instead of ContextService in Web8 | Does not affect SDL Tridion 2013 SP1 |
| 51degrees.context.provider | Activates 51Degrees Context Provider | Requires dxa-51degrees-module. |
| dxa.no-cache | Makes DXA use NoCacheProvider in Tridion | |
| test | Activates Testing context | Only 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.