• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Can we pass a dynamic list of ref-beans to a bean in spring application context file?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am new to spring. I am facing a problem and don't know how to tackle it.
Here is the issue:

I have a spring application context file - spring-application-context-XXX.xml
And i have a bean named,say "aBean" defined like dis :
<bean id="aBean" class="com.some.package.SomeClass" >
Now, I need to pass a list of ref-beans to this bean via setter injection.
The ref-beans have to be presented in some other spring application context file (say, spring-application-context-YYY.xml, which will be included in spring-application-context-XXX.xml via <import resource=""/>.
The number of beans should be dynamic (i.e they can be 3 or 4 or any in number).

Is there any way we can achieve this?

Thanks in advance for suggestions!
 
Ranch Hand
Posts: 686
Netbeans IDE Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try @Autowired(required=false)
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic