views:

289

answers:

1

I have an EAR with modules:

  • foo-api.jar
  • foo-impl.jar
  • interceptor.jar

In foo-api there is:

@Local
FooService // (interface of a local stateless session bean)

In foo-impl there is:

@Stateless
FooServiceImpl implements FooService //(implementation of the foo service)

In interceptor.jar I want

public class BazInterceptor {

  @EJB
  private FooService foo;

  @AroundInvoke
  public Object intercept( final InvocationContext i) throws Exception {
    // do someting with foo service
    return i.proceed();
  }

The question is:

Will a Java EE 5 compliant application server (e.g. JBoss 5) inject into the interceptor? If no, what is good strategy for accessing the session bean?

To consider:

  • Deployment ordering / race conditions
A: 

My experience has indicated the injection can only occur in managed classes: EJB (Entity, Session or Message) and Servlets.

Andrew