gicig
gicig

Reputation: 334

Where is it all allowed to inject EJB?

Is it possible to inject an EJB into any class? And who performs the injection - EJB container or the container of the classes that contain EJB annotation?

Upvotes: 2

Views: 827

Answers (1)

ujulu
ujulu

Reputation: 3309

Here is an extract from Java EE Tutorial:

Dependency injection is the simplest way of obtaining an enterprise bean reference. Clients that run within a Java EE server-managed environment, JavaServer Faces web applications, JAX-RS web services, other enterprise beans, or Java EE application clients, support dependency injection using the javax.ejb.EJB annotation.

Applications that run outside a Java EE server-managed environment, such as Java SE applications, must perform an explicit lookup. JNDI supports a global syntax for identifying Java EE components to simplify this explicit lookup.

Upvotes: 3

Related Questions