cancel
Showing results for 
Search instead for 
Did you mean: 

Overriding One Time Charge Entry Populator

Former Member
0 Kudos

Hello Experts,

I'm currently trying to override the populate method in the OneTimeChargeEntryPopulator since I added new attribute that I want to be populated. So, I've created the custom populator which extends the OneTimeChargeEntryPopulator and I've added the new spring configurations.

However my question is, should I create custom classes that extend any class that calls the old populator in order to make them call the new populator? or is there a best practice that should be followed?

Accepted Solutions (1)

Accepted Solutions (1)

former_member618655
Active Participant
0 Kudos

. For example your cartFacade is calling your OneTimeChargeEntryPopulator. The best strategy is to create a new populator say 'CustomOneTimeChargeEntryPopulator'. Create bean definiton for this populator in your extension-spring.xml file and give the same alias as 'OneTimeChargeEntryPopulator'. Once that is done, your application context will know that it has to pick your 'CustomOneTimeChargeEntryPopulator'. Sample bean definiton below.

 <alias name="defaultOneTimeChargeEntryPopulator" alias="chargeEntryPopulator" />
     <bean id="defaultOneTimeChargeEntryPopulator" class="com.outofbox.populator.OneTimeChargeEntryPopulator">
     </bean>
 
 
 <alias name="customOneTimeChargeEntryPopulator" alias="chargeEntryPopulator" />
     <bean id="customOneTimeChargeEntryPopulator" class="com.xxx.populator.CustomOneTimeChargeEntryPopulator"
           parent="defaultOneTimeChargeEntryPopulator">
     </bean>


the first bean definiton is OOB, the second one is yours which will override the default one.

Former Member
0 Kudos

OK thanks so much now I understand. However just one more question I need to ask, the following way should be done when overriding any OOB class or is it only applicable for the populators?

former_member618655
Active Participant
0 Kudos

it is the spring way of overriding beans. Apply to all beans.

Answers (0)