mybatis配置问题

时间:2011-05-13 11:17:16

标签: database config mybatis

我是MyBatis的新手。

我一直在尝试在我写的网络服务中配置mybatis,但还没有运气。

我已经做过的是,

  1. UserInfoMapper接口
  2. 带有mapper名称空间的UserInfoMapper.xml,带有UserInfoMapper接口和select
  3. mybatis-config.xml,其中typeAlias用作UserInfoMapper.xml中的结果类型
  4. datasourceContext.xml中的oracle(我得连接)的dataSource bean
  5. org.mybatis.spring.mapper.MapperScannerConfigurer bean,basePackage指向datasourceContext.xml中的UserInfoMapper接口
  6. sqlSessionFactory bean即。 org.mybatis.spring.SqlSessionFactoryBean,包含我的dataSource和configLocation的属性
  7. userInfoMapper bean即。 org.mybatis.spring.mapper.MapperFactoryBean,带有属性mapperInterface(value =“is.simnn.act.web.ngs.persistence.UserInfoMapper”)和datasourceContext.xml中的sqlSessionFactory属性(ref =“sqlSessionFactory”)
  8. 然后在我的applicationContext.xml中我有以下内容,
  9.   

    <import resource="classpath:META-INF/wsContext.xml" />
    <import resource="classpath:META-INF/db/datasourceContext.xml" />
    

    在我的测试用例中,当我调用jaxws:endpoint时,我一直收到NullPointerException,它引导我进入UserInfoMapper接口。

    对我的配置可能出错的任何想法或提示?

    谢谢, Gunnlaugur

1 个答案:

答案 0 :(得分:0)

没有更多信息就很难评论。你可以发布你的UserInfoMapper.java接口,你的UserInfoMapper.xml和你的堆栈跟踪吗?您确定接口中的方法名称与XML中的SELECT ID相匹配吗?