Hello
How does EJB 3.2 now handle EJB References?
One of the constant questions on stackflow is about dependent
injection of session bean inside another session bean in order to
invoke some behaviour.
I have been playing with Arquillian and checking the GlassFish 3
implementation. The following does not currently work in my
integration tests.
import javax.annotation.*;
import javax.ejb.*;
import java.util.Properties;
@Startup
@Singleton(name="MasterProcessor")
@EJB(name="java:app/MasterProcessor", beanInterface=MasterProcessor.class)
public class MasterProcessorBean implements MasterProcessor {
private Properties properties = new Properties();
@PostConstruct
public void appStartUp() {
properties.putAll(System.getProperties());
}
@PreDestroy
public void appShutdown() {
properties.clear();
}
/* ... */
}
@Startup
@Singleton
@DependsOn("MasterProcessor")
public class DetailSection implements Facilitator {
@EJB(mappedName = "java:app/MasterProcessor")
MasterProcessor conductor;
@Override
public MasterProcessor getMasterProcessor() {
return conductor;
}
/* ... */
}
What I want to know is, is supposed to work in the upcoming EJB 3.2?
I assume the singletons are in the same application and module; if the
implementation details are considered correctly then the EJB container
should be able to inject MasterProcessor proxy into the DetailSection
proxy.
http://stackoverflow.com/questions/10089957/explicite-local-ejb-not-injected-with-arquillian
--
Peter Pilgrim,
**Java Champion**,
Java EE Software Development / Design / Architect for financial
services, London, UK
JavaFX ++ Scala ++ Groovy ++ Android ++ Java
:: http://www.xenonique.co.uk/blog/ ::
:: http://twitter.com/peter_pilgrim ::
:: http://audio.fm/profile/peter_pilgrim ::
:: Skype Call peter_pilgrim ::
:: http://java-champions.java.net/ ::