Accessing SAP Commerce Cloud properties in Web Context

The webservicescommons extension contains HybrisPropertiesWebApplicationContextInitializer class. The class allows you to access SAP Commerce Cloud properties in the web context and during its initialization.

Configuration

To use the class, simply add following lines to web.xml file in your custom webservice extension:
<context-param>
    <param-name>contextInitializerClasses</param-name>
    <param-value>de.hybris.platform.webservicescommons.initializer.HybrisPropertiesWebApplicationContextInitializer</param-value>
</context-param>

The functionality is used in previewwebservices, personalizationwebservices and permissionswebservices extensions. It allows to overwrite the default spring-security.xml file with a custom one.

Example Usage

The acess to SAP Commerce Cloud properties during the web context initialization allows us to use the properties as placeholders in <import> tags.
<import resource="${extension.config.file:config/default-spring-file.xml}"/>
extension.config.file=classpath:/extension/custom-spring-file.xml