I am having trouble wiring up a bean hierarchy. I have an abstract template class which looks like:
And a concrete subclass:Code:public abstract class ClaimAction extends DefaultAction { private ClaimManager claimManager; public void setClaimManager(ClaimManager claimManager) { this.claimManager = claimManager; } public void execute() { //blah blah some code here claimManager.doSomething(); showClaim(); } private Claim loadClaim(long claimID) { return } /** * Subclasses implement this */ protected abstract ActionForward showClaim(); }
When I try to run the showClaim method on ClaimSummaryAction I get a nullpointer in the superclass as the claimManager is not set.Code:public class ClaimSummaryAction extends ClaimAction { protected ActionForward showClaim() { //show it } }
My config file looks like:
I need both the abstract class and the subclass to be able to access the claimManager. I realise I must be doing something wrong here, any help much appreciated.Code:<bean id = "claimAction" class="com.***.claim.ClaimAction" abstract="true" > <property name="claimManager"><ref bean="claimManager" /></property> </bean> <bean id = "claimSummaryAction" parent="claimAction" class="com.***.claim.ClaimSummaryAction" /> <bean id = "claimDAO" class="com.***.claim.ClaimDAO"> <property name="sessionFactory"><ref bean="mySessionFactory"/></property> </bean>


Reply With Quote