Hi, hopefully the group can help.
I have an unmanaged object in which I am trying to use a local stateless EJB.
I am using new InitialContext().lookup("xxx")
I don't want to know what the actual bean implementation is, just the local
interface.
Somehow @EJB annotation can resolve the local interface and inject the bean
in the managed object,
but there is no name that I can use in lookup() to find the EJB just by the
local interface.
What magic can I use to duplicate the @EJB annotaion functionality?
I do not want to reference *Mock class anywhere, just the local interface,
also I do not want to use @Stateless(name= "XXX") things either as the @EJB
does not need that.
Here's the code:
@Stateless
@Local(JunkMailEraserLocal.class)
public class JunkMailEraserMock implements JunkMailEraserLocal
{
@Override
public void erase()
{
// just a fake test
}
@Override
public boolean isMock()
{
return true;
}
}
// CLIENT:
class Client
{
@EJB JunkMailEraserLocal eraser; // WORKS!
lookup("WHAT DO I PUT IN HERE") // or replace with some CDI magic perhaps?
Thanks!
}
--
[Message sent by forum member 'lprimak']
View Post: http://forums.java.net/node/837497