I'm relatively new to Spring, but have read documentation, and looked for examples, and may be hitting a bug (or I might just be confused).
I've got the following entries in my "services.xml" file:
Given that this is a command-line launched application (a migration "tool"), the main() function looks as follows:
<bean id="workBean" class="com.myCompany.WorkBean">
<ref bean="firstStep" />
<ref bean="secondStep" />
<ref bean="thirdStep" />
<bean id="abstractStep" abstract="true" class="com.myCompany.AbstractWorkStep">
<property name="name" value="Abstract Step - This should not happen!"/>
<bean id="firstStep" parent="abstractStep" class="com.myCompany.WorkStepOne">
<property name="name" value="Step 1"/>
<bean id="secondStep" parent="abstractStep" class="com.myCompany.WorkStepTwo">
<property name="name" value="Step 2"/>
<bean id="thirdStep" parent="abstractStep" class="com.myCompany.WorkStepThree">
<property name="name" value="Step 3"/>
My worker class contains an ArrayList<AbstractWorkStep> steps list, with the appropriate getters and setters.
public static void main(String args)
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
WorkBean worker = ctx.getBean("workBean", com.myCompany.WorkBean.class);
When I debug (in Eclipse) during a test, and I look at the worker object, and examine the steps list in the worker class, I find that the name attribute in the instantiated instance of each of the subclasses of AbstractWorkStep is null, which is causing problems with code later in the application.
My understanding is that the subclasses, because they reference the abstractStep as their parent, should override the name initially set in the abstractStep class, and the names should be firstStep, secondStep, and thirdStep, respectively. At a minimum, I would expect that the name for each of them would be "Abstract Step - This should not happen!", which would give me a bit more information than the null is giving me.
My first question is, am I correct in the assumption that, given the configuration above, I should see firstStep, secondStep, and thirdStep, or should I see "Abstract Step - This should not happen!" instead?
My second question is, given that I'm currently seeing a null in the name value for all of the instances, what am I missing in my configuration or my instantiation of the bean that is causing it simply not to have a value?
I'm pretty sure (given my relative inexperience) that this is a problem on my end, but I'm not sure where to start to look for the solution. Any assistance would be greatly appreciated.