From the course: Java EE 8 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Injection points

Injection points - Java EE Tutorial

From the course: Java EE 8 Essential Training

Start my 1-month free trial

Injection points

- [Instructor] In this lesson, we will use CDI to inject our InventoryService bean into a JSF backing bean. So you'll see that we have our local inventory service which implements the InventoryService interface. And we're going to leverage that within our CatalogItemFormBean. This bean serves as a backing bean within our JSF application and because it is a backing bean, it can have its dependencies injected into it. Now, right now you see that we're getting an EJB injected into the CatalogItemFormBean. We no longer need to use the EJB annotation since CDI has come along. We can just change this over to Inject and the Inject annotation is preferred moving forward with EJBs. Now, in order to inject our InventoryService, we just declare a field of type InventoryService and then we can give it a name of inventoryService and then we add the Inject annotation on this field and that's known as the injection point. So…

Contents