Spring framework extension file (spring-extension.xml)

The spring-extension.xml file is provided for you to use to override existing URL mappings or to define new mappings to customize Management Center objects.

When you need to change or create a URL mapping within the Spring framework always use this spring-extension.xml extension file to define your custom mappings. Do not modify any spring-ibm-component.xml files that are provided by default for each Management Center component. The Spring extension file takes precedence over all other Spring configuration files when you add configurations for objects that are defined in the other files. By including all of your custom configurations within this file, you can ensure that your customizations are not overwritten when you apply maintenance or upgrade HCL Commerce.

The initial spring-extension.xml file that is supplied with HCL Commerce include sample bean definitions that configure controllers for handling single sign on. You can use these sample controller configurations to help you model controller configurations for your own custom objects and views. The following code snippet shows a sample controller configuration within the spring-extension.xml.

<?xml version="1.0" encoding="UTF-8"?>
1<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
      To enable Single Sign On, uncomment the following Logon, Logout and ResolveIdentity controller configurations. 
2 <bean id="/Logon" class="com.ibm.commerce.foundation.client.lobtools.spring.AuthenticationClientLibraryController">
3   <property name="urlObject" value="Person"/>
      <property name="contextParameters">
4     <props>
          <prop key="channelId">channelId</prop>
      <property name="clientLibrary" value="com.ibm.commerce.member.facade.client.MemberFacadeClient"/>
      <property name="clientLibraryMethod" value="authenticatePassword"/>
      <property name="aliasParameters">
          <prop key="password">logonPassword</prop>
      <property name="generateLTPAToken" value="true"/>
      <property name="successView" value="/jsp/commerce/shell/restricted/AuthenticationSuccess.jsp"/>
      <property name="failureView" value="/jsp/commerce/shell/restricted/AuthenticationFailed.jsp"/>
1 <beans>
The top-level element that must be included in all Spring framework configuration files. Do not include any other elements at this level in your spring-extension.xml file.
2 <bean>
Each controller or view resolver configuration must be defined within a separate bean definition or <bean> element.
The value that identifies the configuration. This value must match the value for the URL request within the definition file that defines the object or service.
The controller class that is to be used to process the request.
3 <property>
Information to pass to the controller about the Management Center object, and about how the Spring framework is to process the request. For example, properties can be configured to indicate the JSP files to use for resolving views, or to indicate the action that is to performed on an object, such as to create, change, or delete the object.
The name of the property. This attribute cannot be null.
The value of the property.
4 <props>
Additional information to pass to the controller for a configured <property> element. Each property for the property is configured as a separate <prop key="parameter_nam">value</prop subelement within the <props> subelement. For example, you can use a <props> element and multiple <prop> subelements to include a list of context or default parameter values.
The name of the property or parameter, such as storeId, or langId.
When you need to modify the spring-extension.xml file, test your changes within your development environment before deploying the changes to your production environment.
HCL Commerce Version or laterNote: From HCL Commerce version onwards, Spring is upgraded from version 4.x to version 5.x. You must update your existing spring-extension.xml Spring configuration file with the supportedMethods property and the associated values of GET and POST.
For example:
<bean id="/GetRootManagedDirectory" class="org.springframework.web.servlet.mvc.ParameterizableViewController">
<property name="viewName" value="/jsp/commerce/attachment/restricted/GetRootManagedDirectory.jsp"/>
<property name="supportedMethods" value="GET,POST"/>

For more information about creating controller configurations, see Customizing controller configurations.