Friday, 22 April 2011

JavaEE: Using @EJB annotation

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

public class DataStoreImpl implements DataStoreLocal{
        public static final String COMPONENT_NAME = "dataStoreImpl";

 protected Test test;

 public String getData() {
  // using test
Local business interface:
public interface DataStoreLocal {
 public String getData();
DataStoreLocal data = (DataStoreLocal) Component.getInstance(
     DataStoreImpl.COMPONENT_NAME, true);

No comments:

Post a Comment