This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mybatis + spring don't work.

 
zb cong
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
this is the spring config for mybatis:

<bean id="userDao" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
<property name="mapperInterface" value="org.jpadbf.spring3mybatis3.dao.UserDao" />
</bean>

and this is my test code:
'
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
System.out.println(applicationContext.getBean("userDao"));

but it print "null", why? i can initial other beans in the spring config file, so i think there is not problem with the spring.

i use spring3.1.0 M2, mybatis3.0.5 and mybatis-spring1.0.1

thanks for any helps.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was there anything in the logs when starting up the app? Maybe it can't find something the DAO relies on?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic