GAHHHHH what a MORON I am!!! I didn't realize I was also doing

@Inject
SqlSession sqlSession;

In another test and of course that was blowing up because I wasn't passing
the @Name.

Sorry for your time.  At least I hope this is an ok way to pass data to a
provider in a Module, because it's working now:

SqlSessionProvider myDbProvider = new
SqlSessionProvider("mydb-ibatis-config.xml");
bind(SqlSession.class).annotatedWith(Names.named("MyDB")).toProvider(myDbProvider);




On Mon, Aug 24, 2009 at 1:40 PM, Rick <[email protected]> wrote:

>
>
> On Mon, Aug 24, 2009 at 12:03 PM, Stuart McCulloch <[email protected]>wrote:
>
>>
>>>
>>> This ends up with sqlSession never being bound:
>>>
>>> //SqlSessionProvider modified has constructor, takes resource file name
>>>
>>> //Module:
>>> SqlSessionProvider myDbProvider = new
>>> SqlSessionProvider("mydb-ibatis-config.xml");
>>>
>>> bind(SqlSession.class).annotatedWith(Names.named("MyDB")).toProvider(myDbProvider);
>>>
>>> //Implementation - NEVER CALLED
>>> @Inject
>>> public void setSqlSession(@Named("MyDB") SqlSession sqlSession) {
>>>     System.out.println("!!!!!! MyDbIbatisDao setSqlSession");
>>>     this.sqlSession = sqlSession;
>>> }
>>>
>>> In this later case, I never see "setSqlSession" called (and obviously my
>>> Provider get thus never called either.)
>>> Am I declaring my setter incorrectly with the named annotation? I've even
>>> tried with field injection and no luck either.
>>>
>>> @Inject @Named("MyDB")
>>> protected SqlSession sqlSession;
>>>
>>
>> probably a silly question, but that annotation is
>> com.google.inject.name.Named right?
>>
>>
>
>
> Yes:
>
>
> import com.google.inject.name.Named;
> import com.google.inject.Inject;
>
>
>



-- 
Rick R

--~--~---------~--~----~------------~-------~--~----~
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