Hi,
Can you have bind any object to scope RequestScoped ?
I want to inject a JdbcTemplate that is based on a property of
MagicUserPrincpal (implements Princpal).
What I kind of want to do is to set up a provider so that my
subresource can be created like this:
@Inject public MySubResource( @LoginSpecificTemplate JdbcTemplate t) {
this.t = t;
}
For that to work, though, I would want to:
bind( JdbcTemplate.class )
.annotatedWith( LoginSpecificTemplate.class )
.toProvider ( MyTemplateProvider.class )
.in( Scopes.RequestScoped );
then make a provider MyTemplateProvider that is RequestScoped and gets
injected into him the MagicUserPrincipal. Here lies the problem:
providers have to be bound as singletons ... so I can't do this the
way I'm thinking.
Currently I manage all of this through root resources and assisted
injection. It works OK, I was just hoping to come up with something
prettier.
--Chris