Peter Penzov
Peter Penzov

Reputation: 1658

CDI beans without faces-config.xml

I want to use CDI beans into JSF application. I'm interested is there any possible way to avoid the bean declaration into faces-config.xml file. I want to use annotations to declare the beans similar to JSF beans. Is there any possible solution?

Upvotes: 0

Views: 470

Answers (1)

kostja
kostja

Reputation: 61538

There is no need to declare CDI beans anywhere (except for the according annotation on the injection point). All you need is a beans.xml - it may as well be empty - either in the META-INF or in the WEB-INF folder of your war.

For web applications it is a common practice to put the beans.xml in the WEB-INF folder.

Here you can find a nice explanation of the technical background.

Upvotes: 3

Related Questions