Hi,
I'm having troubles setting up injection of objects that are request scoped.
I've tried the following:
bindFactory(new Factory<MyService>() {
@Override
public MyService provide() {
System.out.println("Creating a MyService...");
return new MyService(System.currentTimeMillis());
}
@Override
public void dispose(MyService s) {
System.out.println("Disposing MyService");
}
}).in(RequestScoped.class).to(MyService.class);
The MyService object is created, it is injected as it should be, but
dispose is never called.
Any idea why?
I'm using Jersey 2.3 and Grizzly.
(This post describes the same issue:
http://stackoverflow.com/questions/17396165/using-jersey-2-0-how-do-you-register-a-bindable-instance-per-request)
best regards,
Andreas Lundblad