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;

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