1

How does one define an array of arrays in Spring xml? Or a list of lists? Tried many things (util:list, value-type="java.util.ArrayList", etc, etc etc, none worked. Essentially:

<bean id="id">
   <array>
      <array>
         <value>aa</value>
         <value>ab</value>
         <value>ac</value>
      </array>
      <array>
         <value>ba</value>
         <value>bb</value>
         <value>bc</value>
      </array>
   </array>
</bean>

Or:

<bean id="id">
   <list>
      <list>
         <value>aa</value>
         <value>ab</value>
         <value>ac</value>
      </list>
      <list>
         <value>ba</value>
         <value>bb</value>
         <value>bc</value>
      </list>
   </list>
</bean>

1 Answer 1

1

Finally found something that worked. Instead of trying to call the elements values, call them beans. I little less than intuitive declaring a bean nested inside another bean, but it is allowed and works.

    <bean id="wxSetup" class="java.util.ArrayList">
        <constructor-arg>
            <list>
                <bean class="java.util.ArrayList">
                    <constructor-arg>
                        <list>
                            <value>aa</value>
                            <value>ab</value>
                            <value>ac</value>
                        </list>
                    </constructor-arg>
                </bean>
                <bean class="java.util.ArrayList">
                    <constructor-arg>
                        <list>
                            <value>ba</value>
                            <value>bb</value>
                            <value>bc</value>
                        </list>
                    </constructor-arg>
                </bean>
            </list>
        </constructor-arg>
    </bean>
Sign up to request clarification or add additional context in comments.

1 Comment

Can you please guide here: stackoverflow.com/questions/79023101/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.