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.

How to create instances on the fly in CDI

Let's assume I have a Car class. In my code I want to create 10 cars. Car class has some @Inject …

java java-ee-6 cdi
Can @Inject be made optional in JSR 330 (like @Autowire(required=false)?

Spring's @Autowire can be configured such that Spring will not throw an error if no matching autowire candidates are found: @…

java spring dependency-injection cdi
CDI deployment failure:WELD-001414 Bean name is ambiguous

I have an application, which has multiple modules and various dependencies. When I deploy the application on Glassfish 4, I am …

java maven cdi glassfish-4 weld
Can I use CDI constructor injection for EJBs?

I want to do something like this: @Stateless public class GreeterEjb { private final Greeter greeter; @Inject public GreeterEjb(Greeter greeter) { …

java ejb cdi
What's the overhead of creating a SLF4J loggers in static vs. non-static contexts?

I've always used the following pattern to construct (SLF4J) loggers: private static final Logger log = LoggerFactory.getLogger(MyClass.class); …

java logging static cdi slf4j
WELD-001408: Unsatisfied dependencies for type Employee with qualifiers @Default

I got the following error when deploying to Glassfish on Netbeans. This is the first time I am trying to …

jsf cdi weld
@javax.faces.bean.ManagedProperty in CDI @Named bean returns null

I'm trying to deal with @javax.faces.bean.ManagedProperty but without success ! I've been following this guide, and it not …

jsf cdi managed-bean managed-property
How to disable WELD on WildFly

How to fully disable WELD on WildFly. I don't need it, because I use another DI framework. Exception 0 : javax.enterprise.…

java jboss cdi weld wildfly
Is it possible to @Inject a @RequestScoped bean into a @Stateless EJB?

Is it possible to inject a request-scoped CDI bean into a Stateless session bean? I had asked a related question …

jakarta-ee java-ee-6 cdi ejb-3.1 stateless-session-bean
Canonical way to obtain CDI managed bean instance: BeanManager#getReference() vs Context#get()

I figured that there are two general ways to obtain an auto-created CDI managed bean instance via BeanManager when having …

cdi managed-bean