I'm trying to migrate from Glassfish+Jersey+Weld to Jetty.
I have such a setup: gist of pom.xml, web.xml and Java launcher.
Application seems to start fine, but when serving any request I see that the field that should be injected by Weld (logger
) is null.
@RequestScoped
@Path("/foobar")
@Consumes({ ExtendedMediaType.APPLICATION_JSON,
ExtendedMediaType.APPLICATION_JAVASCRIPT })
@Produces({ ExtendedMediaType.APPLICATION_JSON,
ExtendedMediaType.APPLICATION_JAVASCRIPT })
public class EmailResource extends {
@Inject
private Logger logger;
@Override @POST
public Response create(EmailJob document)
throws URISyntaxException, ResourceException
{
logger.debug("Hi there!");
}
}
What is the problem?
update: Logger producer looks dubious, but it doesn't even get called:
/** This class uses CDI to alias Java EE resources into CDI beans. **/
public class Resources {
@Produces
public Logger produceLog(InjectionPoint injectionPoint) {
return LoggerFactory.getLogger(
injectionPoint.getMember().getDeclaringClass().getName());
}
}