• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

CDI, several managed beans of the same type

 
Ranch Hand
Posts: 89
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm familiarizing myself with CDI. I've started with the standalone applications. I'm using Jboss Weld for this. I can't really create several beans of the same type. Spring framework in contrast allows to register several beans in XML configuration file of the same type but with different bean names/ids:



After that I'm able to retrieve a bean from the context by its name:



But all the tutorials found in the net devoted to CDI and Weld have similar code example:



Is it possible to create several performers and put them into CDI META-INF/beans.xml file?
 
Sergei Zhylinski
Ranch Hand
Posts: 89
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now I think that no. The beans.xml configuration file is not used to declare beans. It mainly indicates that the archive is a candidate for bean scan. The CDI implementations use only bean scan similar to component scan in Spring. It dosn't assume explicitely registering any of the beans in the config.
 
So I left, I came home, and I ate some pie. And then I read this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic