java - How to refer a bean inside "util:list" bean? -


i have bean definitions below

<util:list id="mybeanlist"> <bean id="stage1" class="stageclass"/> <bean id="stage2" class="stageclass"/> </util:list> 

i know if want refer above list, can use

<ref bean="mybeanlist" /> 

but, don't want refer whole list, instead want refer particular bean inside list, "stage1". may <ref bean="mybeanlist$stage1" /> ?

is possible refer inner bean this? yes, how do?

you can use spring expression language this.

<ref bean="#{mybeanlist[0]}" /> 

however, i'm not sure you'll able access bean's id within list. list not allow access bean id or name (that inherently map kind of pattern). if need by-name access, should consider putting beans in map , expression language should allow access name. here example of how can access elements map bean id.

one reference of expression language found this. take @ how studentlist used in spring-config.xml.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -