Hi,

I'm having problems injecting @Named variables inside the request
scope. Removing @Named or attempting to resolve those same variables
in the global scope works fine.

When I attempt to inject the following class:

        @RequestScoped
        private static class GetModule implements Callable<Module>
        {
                private final String name;
                private final Session session;

                @Inject
                public GetModule(@Named("name") String name, Session session)
[...]

using:

                        Map<Key<?>, Object> seedMap = ImmutableMap.<Key<?>,
Object>builder().
                                put(Key.get(String.class, Names.named("name")), 
name).build();
                        return ServletScopes.scopeRequest(new 
InjectingCallable<>(injector,
GetModule.class),
                                seedMap).call();

Where "InjectingCallable.call()" invokes
"Injector.getInstance(GetModule.class).call()" inside the REQUEST
scope.

I get this error:

     1) No implementation for java.lang.String annotated with
@com.google.inject.name.Named(value=name) was bound.
       while locating java.lang.String annotated with
@com.google.inject.name.Named(value=name)

However, if I drop the @Named annotation everything works. I tracked
this down to InjectorImpl:831 that throws an error if an annotated
binding cannot be resolved in the UNSCOPED scope. Why does it throw
this exception? Shouldn't be able to resolve @Named variables in the
request scope? Is this a bug?

Thanks,
Gili

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to