Will Spring support CDI? [closed]

Even though Spring is open source and used and supported by a large community, its future development is controlled by a single company (spring source / vmware). As such, its decisions are inherently non-public and certainly influenced by a large number of factors – like the currents demands of the community, but certainly also financial … Read more

CDI Injection into a FacesConverter

Replace @FacesConverter(value = “categoryConverter”) by @Named and use <h:inputSomething converter=”#{categoryConverter}” /> or <f:converter binding=”#{categoryConverter}” /> instead of <h:inputSomething converter=”categoryConverter” /> or <f:converter converterId=”categoryConverter” /> By the way, similar problem exist for @EJB inside a @FacesConverter. It however offers a way to be grabbed by JNDI manually. See also Communication in JSF 2.0 – Getting an … Read more

What is Weld, JSR-299?

What does Weld do/give you? Weld is the reference implementation of the abstract JSR-299 API, which is better known as CDI, Contexts and Dependency Injection, an API which is provided through javax.enterprise.context and javax.enterprise.inject packages. How does it relate to Java EE 6? JSR-299 is part of Java EE 6 (JSR-316). How would one use … Read more

Java Dependency injection: XML or annotations

I can only speak from experience with Guice, but here’s my take. The short of it is that annotation-based configuration greatly reduces the amount you have to write to wire an application together and makes it easier to change what depends on what… often without even having to touch the configuration files themselves. It does … Read more

Meaning of bean discovery mode annotated in CDI 1.1

When using bean-discovery-mode=”annotated” only classes with a bean defining annotation are discovered. All other classes are ignored. Any scope type is a bean defining annotation. If a scope type is declared on a bean class, then the bean class is said to have a bean defining annotation [spec]. The 1.1 spec is not completely clear … Read more

How to install and use CDI on Tomcat?

Tomcat as being a barebones JSP/Servlet container doesn’t support CDI out the box. It is not correct to drop jakartaee-api.jar or javaee-api.jar in /WEB-INF/lib just to get your code to compile. The JEE API JAR contains solely the API classes, not the concrete implementation. Get rid of the whole JAR. It can cause many other … Read more