jabal
jabal

Reputation: 12337

Injecting a POJO class from an EJB jar into an EJB in a different EJB jar

Given I have two EJB jars in an ear: A.jar and B.jar. Can I inject a utility class Autil that is not an EJB, just a POJO from A.jar into an EJB that is in B.jar using CDI? I cannot find this clearly in the Java EE specs. (Btw. I'm using Glassfish 3.1.1)

Note: Of course I could try it (and already had meanwhile) but that way I could only check it with specific AS and I would like to know what the spec says about it because I am trying to be vendor neutral.

Upvotes: 3

Views: 532

Answers (1)

LightGuard
LightGuard

Reputation: 5378

Firstly, if you're using GlassFish do yourself a favor and use 3.1.2.2. Next, yes you should be able to do that just fine. Make sure both jars have META-INF/beans.xml as well as your web app (WEB-INF/beans.xml)

Upvotes: 3

Related Questions