I have an interface
@Local
public interface TestService extends Serializable
{
public void aMethod();
}
party bean that implements it
@Stateless
public class MyappServiceBean implements TestService
{
private static final long serialVersionUID = 1L;
@Override
public void aMethod()
{
}
}
driven bean
@ManagedBean
public class MyappBean implements Serializable
{
private static final long serialVersionUID = 1L;
@EJB
private TestService service;
...
}
and this is pojo
public class TestPojo implements Serializable
{
private static final long serialVersionUID = 1L;
private final TestService service;
public TestPojo()
{
service = (TestService) InitialContext.doLookup("???/TestService");
}
...
}
All packages are packed:
myapp.war
|
+ WEB-INF
|
+ lib
| |
| + common.jar
| |
| - com.example.common.ejb.TestService (@Local interface)
| |
| - com.example.common.util.TestPojo (simple pojo, must lookup)
|
+ classes
|
- com.example.myapp.ejb.MyappServiceBean (@Stateless impl)
|
- com.example.myapp.jsf.MyappBean (jsf @ManagedBean)
since I want to use common.jarinside different applications, I want to search based on the name of the interface Testservice, just as I insert @EJB TestService service;into @ManagedBeanor@WebServlet
how to achieve this?
source
share