Не понятный Exception , может кто сталкивался ? Не получаю никаких warnings , сам бин определён вроде правильно.
<bean id="chosen" class="maks.example2.City">
<property name="chosenCity" value="#{cities[2]}"/>
</bean>
<util:list id = "cities">
<bean class="maks.example2.City" p:name="Chicago" p:state="IL" p:population="2853114"/>
<bean class="maks.example2.City" p:name="Atlanta" p:state="GA" p:population="537958"/>
<bean class="maks.example2.City" p:name="Dallas" p:state="TX" p:population="1279910"/>
<bean class="maks.example2.City" p:name="Houston" p:state="TX" p:population="2242193"/>
<bean class="maks.example2.City" p:name="Odessa" p:state="TX" p:population="90943"/>
<bean class="maks.example2.City" p:name="El Paso" p:state="TX" p:population="613190"/>
<bean class="maks.example2.City" p:name="Jal" p:state="NM" p:population="1996"/>
<bean class="maks.example2.City" p:name="Las Cruces" p:state="NM" p:population="91865"/>
</util:list>
Main:
Instrumentalist kenny = context.getBean("kenny",Instrumentalist.class);
Instrumentalist carl = context.getBean("carl",Instrumentalist.class);
System.out.println("Kenny: "+kenny.getInstrument().getClass().getName()); // WORKING
System.out.println("Carl: "+carl.getInstrument().getClass().getName()); // WORKING
City city = context.getBean("chosen",City.class); // CAN'T FIND!
System.out.println("Chosen city: "+city.getChosenCity());
Console output:
Application loading!
Kenny: maks.example2.Piano
Carl: maks.example2.Saxophone
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'chosen' is defined