aspose file tools*
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
Author

Mybatis + spring don't work.

zb cong
Ranch Hand

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

Joined: May 26, 2003
Posts: 30938
    
158

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


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
 
subject: Mybatis + spring don't work.