各位,使用spring3自动扫描mapper为null。我的配置文件如下
1)application.xml
<context:annotation-config />
...
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.sd.jery.mapper" />
</bean>
2)java代码调用(部分)
@Transactional
public class UserDaoImpl implements IUserDao { @Autowired
private UserMapper userMapper; public UserMapper getUserMapper() {
return userMapper;
} public void setUserMapper(UserMapper userMapper) {
this.userMapper = userMapper;
}
}
求支援,Spring新手。
1)application.xml
<context:annotation-config />
...
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.sd.jery.mapper" />
</bean>
2)java代码调用(部分)
@Transactional
public class UserDaoImpl implements IUserDao { @Autowired
private UserMapper userMapper; public UserMapper getUserMapper() {
return userMapper;
} public void setUserMapper(UserMapper userMapper) {
this.userMapper = userMapper;
}
}
求支援,Spring新手。
解决方案 »
- Hibernate主键生成策略的困扰
- spring动态载入
- 关于在Spring中对ibaits配置文件的解释invocation of init method failed nested exception is jav
- struts2问题
- hibernate存储File类型的问题
- 含函数的存储过程
- 关于:org.apache.struts.action 包的问题
- 我打算用Filter作为系统的权限控制,在Filter中判断访问的uri是否有足够权限可访问,但我使用webWork框架,所有的jsp跳转都是dispather方
- 请教一个Struts刷新问题
- 怎样写一个随J2EE应用服务器启动时创建、关闭时清除的类。
- 怎样发布一个网站
- 请问如何在flash中加入百度统计
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.sd.jery.mapper" />
</bean>与UserDaoImpl 完全木有关系看下书吧,楼主还没有明白基础呢。