我是 MyBatis 的新手。
我一直在尝试在我正在编写的 web 服务中配置 mybatis,但还没有运气。
我已经做的是,
- UserInfoMapper 接口
- 带有映射器命名空间的 UserInfoMapper.xml,带有我的 UserInfoMapper 接口和一个选择
- 带有 typeAlias 的 mybatis-config.xml 用作 UserInfoMapper.xml 中的结果类型
- datasourceContext.xml 中 oracle 的 dataSource bean(我已连接)
- org.mybatis.spring.mapper.MapperScannerConfigurer bean,basePackage 指向 datasourceContext.xml 中的 UserInfoMapper 接口
- sqlSessionFactory bean 即。org.mybatis.spring.SqlSessionFactoryBean 具有我的 dataSource 和 configLocation 的属性
- userInfoMapper bean 即。org.mybatis.spring.mapper.MapperFactoryBean 与 datasourceContext.xml 中的属性 mapperInterface (value="is.simnn.act.web.ngs.persistence.UserInfoMapper") 和 sqlSessionFactory 属性 (ref="sqlSessionFactory")
- 然后在我的 applicationContext.xml 我有以下内容,
<import resource="classpath:META-INF/wsContext.xml" />
<import resource="classpath:META-INF/db/datasourceContext.xml" />
在我的测试用例中,当我调用 jaxws:endpoint 时,我不断收到 NullPointerException,它引导我进入我的 UserInfoMapper 接口。
关于我的配置可能有什么问题的任何想法或提示?
谢谢, Gunnlaugur