Documentation Home

4.0 to 5.0 AppContext Migration

Application Context Changes

  • In applicationContext-admin-filter.xml:
    • Remove blPrecompressedArtifactFilter from blPostSecurityFilterChain.
  • In applicationContext-admin-security.xml:

    • Change blAccessDecisionManager in blAdminFilterSecurityInterceptor to blFilterAccessDecisionManager
    • Change

      <bean id="blAccessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
              <property name="decisionVoters">                        
      

      to

      <bean id="blGlobalDecisionVoters" class="org.springframework.beans.factory.config.ListFactoryBean">
              <property name="sourceList">
      
    • Add the following after the blGlobalDecisionVoters bean:

      <bean id="blFilterDecisionVoters" parent="blGlobalDecisionVoters" class="org.springframework.beans.factory.config.ListFactoryBean">
          <property name="sourceList">
              <list merge="true">
              </list>
          </property>
      </bean>
      
      <!-- This access decision manager works in conjunction with the blAdminFilterSecurityInterceptor and http security -->
      <bean id="blFilterAccessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
          <property name="decisionVoters" ref="blFilterDecisionVoters"/>
      </bean>
      
    • Replace:

      <sec:global-method-security access-decision-manager-ref="blAccessDecisionManager" secured-annotations="enabled" /> 
      

      with

      <sec:global-method-security access-decision-manager-ref="blFilterAccessDecisionManager" pre-post-annotations="enabled" secured-annotations="enabled" />
      
  • applicationContext-admin.xml

    • Remove bean blPrecompressedArtifactFilter
    • Replace:

      <mo:override id="blMetadataOverrides">
          <mo:overrideItem ceilingEntity="org.broadleafcommerce.core.catalog.domain.Product">
              <mo:field name="defaultSku.quantityAvailable">
                  <mo:property name="excluded" value="true" />
              </mo:field>
              <mo:field name="templatedEntity.template">
                  <mo:property name="tab" value="ProductImpl_Marketing_Tab" />
                  <mo:property name="tabOrder" value="2000" />
              </mo:field>
              <mo:field name="displayTemplate">
                  <mo:property name="excluded" value="true" />
              </mo:field>
          </mo:overrideItem>
          <mo:overrideItem ceilingEntity="org.broadleafcommerce.core.catalog.domain.Category">
              <mo:field name="templatedEntity.template">
                  <mo:property name="tab" value="CategoryImpl_Marketing_Tab" />
                  <mo:property name="tabOrder" value="2000" />
              </mo:field>
              <mo:field name="displayTemplate">
                  <mo:property name="excluded" value="true" />
              </mo:field>
          </mo:overrideItem>
      </mo:override>
      

      with

      <mo:override id="blMetadataOverrides">
          <mo:overrideItem ceilingEntity="org.broadleafcommerce.core.catalog.domain.Product">
              <mo:field name="templatedEntity.template">
                  <mo:property name="group" value="ProductImpl_General_Misc" />
                  <mo:property name="order" value="1" />
              </mo:field>
              <mo:field name="defaultSku.quantityAvailable">
                  <mo:property name="excluded" value="true" />
              </mo:field>
              <mo:field name="displayTemplate">
                  <mo:property name="excluded" value="true" />
              </mo:field>
          </mo:overrideItem>
          <mo:overrideItem ceilingEntity="org.broadleafcommerce.core.catalog.domain.Category">
              <mo:field name="templatedEntity.template">
                  <mo:property name="group" value="CategoryImpl_Category_Miscellaneous" />
                  <mo:property name="order" value="1000" />
                  <mo:property name="tooltip" value="TemplatedEntity_CagtegoryImpl_tooltip" />
              </mo:field>
              <mo:field name="displayTemplate">
                  <mo:property name="excluded" value="true" />
              </mo:field>
          </mo:overrideItem>
      </mo:override>
      
  • core/applicationContext.xml

    • Remove the following:
        <bean class="com.mycompany.sample.vendor.nullPaymentGateway.service.payment.NullPaymentGatewayType"/>
    
    <!-- Add Sample Thymeleaf Processor to test Hosted Payment Gateway (e.g. PayPal Express Flow) -->
    <bean id="myNullPaymentGatewayHostedActionProcessor" class="com.mycompany.sample.vendor.nullPaymentGateway.web.processor.NullPaymentGatewayHostedActionProcessor"/>
    <bean id="mySamplePaymentProcessors" class="org.springframework.beans.factory.config.SetFactoryBean">
        <property name="sourceSet">
            <set>
                <ref bean="myNullPaymentGatewayHostedActionProcessor"/>
            </set>
        </property>
    </bean>
    <bean class="org.broadleafcommerce.common.extensibility.context.merge.LateStageMergeBeanPostProcessor">
        <property name="collectionRef" value="mySamplePaymentProcessors"/>
        <property name="targetRef" value="blDialectProcessors"/>
    </bean>
    
    <bean id="mySampleConfigurationServices" class="org.springframework.beans.factory.config.ListFactoryBean">
        <property name="sourceList">
            <list>
                <ref bean="blNullPaymentGatewayConfigurationService"/>
                <ref bean="blNullPaymentGatewayHostedConfigurationService"/>
            </list>
        </property>
    </bean>
    <bean class="org.broadleafcommerce.common.extensibility.context.merge.LateStageMergeBeanPostProcessor">
        <property name="collectionRef" value="mySampleConfigurationServices"/>
        <property name="targetRef" value="blPaymentGatewayConfigurationServices"/>
    </bean>
    <!-- /End DemoSite NullPaymentGateway Config -->
    
  • applicationContext-rest-api-security.xml

    • Add the following:
      <!-- Disable filter security on the swagger URIs -->
    <sec:http pattern="/api/**/webjars/**" security="none" />
    <sec:http pattern="/api/**/images/favicon-*" security="none" />
    <sec:http pattern="/api/**/jhawtcode/**" security="none" />
    <sec:http pattern="/api/**/swagger-ui.html" security="none" />
    
  • applicationContext-security.xml

    • Replace all "/null-" with "/sample-"
      • We've created a sample payment module and renamed it from null to more clearly indicate the intension.
  • site/applicationContext.xml

    • Remove the following:
    <!-- Scan DemoSite Sample Payment Gateway Implementation -->
    <context:component-scan base-package="com.mycompany.sample" />
    
    <!-- Add Sample Thymeleaf Processor to test Hosted Payment Gateway (e.g. PayPal Express Flow) -->
    <bean id="myNullPaymentGatewayHostedActionProcessor" class="com.mycompany.sample.vendor.nullPaymentGateway.web.processor.NullPaymentGatewayHostedActionProcessor"/>
    <bean id="mySamplePaymentProcessors" class="org.springframework.beans.factory.config.SetFactoryBean">
        <property name="sourceSet">
            <set>
                <ref bean="myNullPaymentGatewayHostedActionProcessor"/>
            </set>
        </property>
    </bean>
    <bean class="org.broadleafcommerce.common.extensibility.context.merge.LateStageMergeBeanPostProcessor">
        <property name="collectionRef" value="mySamplePaymentProcessors"/>
        <property name="targetRef" value="blDialectProcessors"/>
    </bean>
    
    <bean id="mySampleConfigurationServices" class="org.springframework.beans.factory.config.ListFactoryBean">
        <property name="sourceList">
            <list>
                <ref bean="blNullPaymentGatewayConfigurationService"/>
                <ref bean="blNullPaymentGatewayHostedConfigurationService"/>
            </list>
        </property>
    </bean>
    <bean class="org.broadleafcommerce.common.extensibility.context.merge.LateStageMergeBeanPostProcessor">
        <property name="collectionRef" value="mySampleConfigurationServices"/>
        <property name="targetRef" value="blPaymentGatewayConfigurationServices"/>
    </bean>
    <!-- /End DemoSite NullPaymentGateway Config -->