First, CDI provides a standard framework for dependency injection. It determines how objects get their dependencies, not by creating an instance ( private FooDao dao = new FooDao() ), but through a container that creates and manages the instances. You can learn more about dependency injection (google / wiki).
The standard defines how this works with both JSF and EJB.
- your managed JSF beans can be defined using CDI so that you can deploy services to managed beans, and so CDI manages the life cycle of a managed JSF beans
- An EJB can also benefit from an extended injection of CDI dependencies (they previously had their own, different from DI functionality).
In short, CDI binds all the components in JavaEE in the spring way with all its components, but CDI is the standard.
source share