Top "Cdi" questions

Contexts and Dependency Injection (CDI): Java Platform, Enterprise Edition (Java EE) 5 brought dependency injection (DI) with Convention over Configuration to Enterprise JavaBeans (EJB) 3.0. Java EE 6 introduces the flexible and powerful @Inject dependency injection model (JSR-330 and JSR-299) in addition to the already existing @EJB annotation.

Why use @PostConstruct?

In a managed bean, @PostConstruct is called after the regular Java object constructor. Why would I use @PostConstruct to initialize …

java dependency-injection jakarta-ee cdi jsr299
Identifying and solving javax.el.PropertyNotFoundException: Target Unreachable

When trying to reference a managed bean in EL like so #{bean.entity.property}, sometimes a javax.el.PropertyNotFoundException: Target …

jsf cdi el managed-bean propertynotfoundexception
WELD-001408: Unsatisfied dependencies for type Customer with qualifiers @Default

I'm a Java EE-newbie. I want to test JSF and therefore made a simple program but can not deploy it. …

jsf jakarta-ee dependency-injection cdi managed-bean
Should I use @EJB or @Inject

I have found this question: What is the difference between @Inject and @EJB but I did not get any wiser. …

java jakarta-ee ejb cdi
Backing beans (@ManagedBean) or CDI Beans (@Named)?

I've just started reading through Core JavaServer Faces, 3rd Ed. and they say this (emphasis mine): It is a historical …

jsf jakarta-ee jsf-2 cdi
What is the difference between @ApplicationScoped and @Singleton scopes in CDI?

In CDI there is the @ApplicationScoped and the (javax.inject) @Singleton pseudo-scope. What is the difference between them? Besides the …

java scope cdi
wildfly: reading properties from configuration directory

I'm trying to read deployment specific information from a properties file in my wildfly configuration folder. I tried this: @Singleton @…

java jakarta-ee jboss cdi wildfly
WELD-000072 Managed bean declaring a passivating scope must be passivation capable

I wrote a simple program in java web forms but i am receiving the following error: WELD-000072 Managed bean declaring …

java cdi jboss-weld
Please explain the @Produces annotation in CDI

I have read about the @Produces annotation in CDI, but I don't understand its usage. public class Resources { // Expose an …

java jakarta-ee cdi
CDI : WELD-001408 Unsatisfied dependencies, how to resolve it?

I do a small test project with CDI. My application is composed of an EJB EAR and WAR, all deployed …

jakarta-ee cdi glassfish-4 weld