Announcement Announcement Module
Collapse
No announcement yet.
repace bean with new one in list property Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • repace bean with new one in list property

    Hi All,

    I have requirement where there is 3-4 beans definition for blCustomPersistenceHandlers bean as below

    HTML Code:
     <bean id="blCustomPersistenceHandlers" class="org.springframework.beans.factory.config.ListFactoryBean" scope="prototype">
            <property name="sourceList">
                <list>
                    <bean class="org.broadleafcommerce.admin.server.service.handler.CategoryCustomPersistenceHandler"/>
                    <bean class="org.broadleafcommerce.admin.server.service.handler.CustomerPasswordCustomPersistenceHandler"/>                
                    <bean class="org.broadleafcommerce.openadmin.server.security.handler.AdminUserCustomPersistenceHandler"/>
                    <bean class="org.broadleafcommerce.admin.server.service.handler.CustomerCustomPersistenceHandler"/>
                    <bean class="org.broadleafcommerce.admin.server.service.handler.ProductCustomPersistenceHandler"/>
                    <bean class="org.broadleafcommerce.admin.server.service.handler.ChildCategoriesCustomPersistenceHandler"/>
                    <bean class="org.broadleafcommerce.admin.server.service.handler.SkuCustomPersistenceHandler"/>
                </list>
            </property>
        </bean>
    HTML Code:
     <bean id="blCustomPersistenceHandlers" class="org.springframework.beans.factory.config.ListFactoryBean" scope="prototype">
            <property name="sourceList">
                <list>
                    <bean class="org.broadleafcommerce.cms.admin.server.handler.PageTemplateCustomPersistenceHandler"/>
                    <bean class="org.broadleafcommerce.cms.admin.server.handler.StructuredContentTypeCustomPersistenceHandler"/>
                    <bean class="org.broadleafcommerce.cms.admin.server.handler.SandBoxItemCustomPersistenceHandler"/>
                    <bean class="org.broadleafcommerce.cms.admin.server.handler.PendingSandBoxItemCustomPersistenceHandler"/>
                    <bean class="org.broadleafcommerce.cms.admin.server.handler.TimeDTOCustomPersistenceHandler"/>
                    <bean class="org.broadleafcommerce.cms.admin.server.handler.RequestDTOCustomPersistenceHandler"/>
                    <bean class="org.broadleafcommerce.cms.admin.server.handler.StructuredContentItemCriteriaCustomPersistenceHandler"/>
                    <bean class="org.broadleafcommerce.cms.admin.server.handler.PageItemCriteriaCustomPersistenceHandler"/>
                </list>
            </property>
        </bean>
    this two bean reference are defined in broadleaf source, so can't change into that.

    Now i want to replace ProductCustomPersistenceHandler handler with my own custom handler, so i make the customehandler by extending productCustomPersistanceHandler and just put the my handler in sourceList

    HTML Code:
    <bean id="blCustomPersistenceHandlers" class="org.springframework.beans.factory.config.ListFactoryBean"> <!-- scope="prototype" -->
            <property name="sourceList">
                <list>
                    <bean class="com.mycompany.server.service.handler.HCProductCustomPersistenceHandler" 
                        />
                </list>
            </property>
        </bean>
    but this is just add my handler into sourceList , i want to replace ProductCustomPersistenceHandler handler with new one..

    how to do that ?


    Thanks,
    Ankit

  • #2
    create a BeanFactoryPostProcessor

    Comment


    • #3
      Hi shenzhenguy,

      Thanks for your reply,
      I never used BeanFactoryPostProcessor before, But What i understand is : BeanFactoryPostProcessor used to load bean or property after configuration.
      And as per my requirement, I have already same bean definition in 3-4 place in jar files for different different handler. when it fetches , all the classes that defines in bean id returns the list. I want to the same list except only one class that should be replaced by my custom class when it fetches the lists.

      Maybe i don't understand the beanFactoryPostProcessor. If this requirement is possibly can be done by BeanFactoryPostProcessor , can you please explain in little brief ?

      Thanks,
      Ankit

      Comment

      Working...
      X