I just followed the ticket-monster tutorial(http://www.jboss.org/jdf/examples/ticket-monster/tutorial/Introduction/) and added a rest-service class to my solution.
package projectFoo.rest;
import java.util.List;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import projectFoo.model.party;
@Path("/partys")
@RequestScoped
public class partyService {
@Inject
private EntityManager em;
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<party> getAllEvents() {
@SuppressWarnings("unchecked")
final List<party> results =
em.createQuery(
"select e from party e order by e.name").getResultList();
return results;
}
}
@Inject is underlined, returning: "No bean is eligible for injection to the injection point [JSR-299 ยง5.2.1]"
When I try to deploy the package, the process will fail and return the following message:
Unsatisfied dependencies for type [EntityManager] with qualifiers [@Default] at injection point.
Do I have to add a bean for the Entity Manager? How should this one look like? The tutorial doesn't mention this. Actually I couldn't find any definition of beans in the final ticket-monster project.