I can enter my own POJO in a managed entity, for example:
import javax.ejb.Stateless;
import javax.inject.Inject;
@Stateless
public class SomeEjb {
@Inject
private SomePojo somePojo;
}
And I have this POJO:
public class SomePojo {
}
It works great. If I embed EJB in JSF bean support, I see that the value somePojois a nonzero value, as expected.
However, if I try to type java.util.Datein SomeEjb, I get the following exception on deployment:
Severe: Exception while loading the app : WELD-001408 Unsatisfied dependencies for type [Date] with qualifiers [@Default] at injection point [[field] @Inject private SomeEjb.date]
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Date] with qualifiers [@Default] at injection point [[field] @Inject private SomeEjb.date]
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:311)
Someeyb:
public class SomeEjb {
@Inject
private Date date;
}
The date has an open constructor with no arguments, and I thought that all CDIs would have to “satisfy dependency”. I'm sure this behavior is "specified", but obviously there is a big hole in my understanding of CDI.
Can someone explain why this is not working? What is the difference between somePojoand java.util.Datein terms of CDI?
Context:
- Java EE 6
- GlassFish 3.1.2.2
- . ,
new Date().