简体   繁体   中英

Define list of a list bean in a spring?

i have a spring configuration file where i have a list of beans. And in my programm i use this configuration file to start these services(beans). I am starting one service after the other. This is how it looks like:

<bean class="java.util.ArrayList" id="configEntries">
        <constructor-arg>
            <list>
                <ref bean="TestService1" />
                <ref bean="TestService2" />
                <ref bean="TestService3" />
                <ref bean="TestService4" />
            </list>
        </constructor-arg>
    </bean> 

Now i would like to start these services multiple and parallel. For example start TestService1 four times at the same time. Is there anyway i can group these beans together, like list in a list ?

<list>
                <list>
                    <ref bean="TestService1" />
                    <ref bean="TestService1" />
                    <ref bean="TestService1" />
                    <ref bean="TestService1" />
                </list>

                <list>
                    <ref bean="TestService2" />
                    <ref bean="TestService2" />
                    <ref bean="TestService2" />
                    <ref bean="TestService2" />
                </list>

                <list>
                    <ref bean="TestService3" />
                    <ref bean="TestService3" />
                    <ref bean="TestService3" />
                    <ref bean="TestService3" />
                </list>

                <list>
                    <ref bean="TestService4" />
                    <ref bean="TestService4" />
                    <ref bean="TestService4" />
                    <ref bean="TestService4" />
                </list>
            </list>
<list>
    <value>
        <list>...</list>
    </value>
    <value>
        <list>...</list>
    </value>
    <value>
        <list>...</list>
    </value>
</list>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM