0

Lets say I have many bean properties like this:

<property name="posture">
        <list>
            <value>Lordosis</value>
            <value>Kyphosis</value>
            <value>Flat-Back</value>
            <value>Sway-Back</value>
            <value>Scoliosis</value>
        </list>
    </property>

After initialization of this bean. How would you go about grabbing information on these properties? For example, the length of the list within each property?

Rachel Gallen
  • 27,943
  • 21
  • 72
  • 81
Jane Doh
  • 2,883
  • 3
  • 15
  • 17

1 Answers1

2

I am new to stackoverflow, so go easy on me. But I think that this should do the trick.
In your main controller, or main method etc, load and inject the bean as follows. In the example, context.xml is the xml document involving the bean. and class is the class that the bean references

ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
Class class = (Class) context.getBean("beanName");
    List list = class.getPosture();

Then reference it as you would any other list. Hope this answers your question.

Ben Green
  • 3,953
  • 3
  • 29
  • 49