The moose likes Spring and the fly likes Mybatis + spring don't work. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Mybatis + spring don Watch "Mybatis + spring don New topic

Mybatis + spring don't work.

zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
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" />

and this is my test code:
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");

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

Joined: May 26, 2003
Posts: 33102

Was there anything in the logs when starting up the app? Maybe it can't find something the DAO relies on?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Mybatis + spring don't work.
It's not a secret anymore!