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?
posted 7 months ago
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.
Something about .... going for a swim. With this tiny ad ...