Shows use of @EJB in a Stateless to have another Stateless bean injected into it.Using Jboss 5 + Seam framework


Bean:
@Stateless
@Name(DataStoreImpl.COMPONENT_NAME)
@Scope(ScopeType.STATELESS)
public class DataStoreImpl implements DataStoreLocal{
public static final String COMPONENT_NAME = "dataStoreImpl";

@EJB
protected Test test;

public String getData() {
// using test
}
}
Local business interface:
@Local
public interface DataStoreLocal {

public String getData();

}
Call:
DataStoreLocal data = (DataStoreLocal) Component.getInstance(
DataStoreImpl.COMPONENT_NAME, true);