---
# System prepended metadata

title: 整合Mybatis-Spring方式二
tags: [Spring-Mybatis]

---

# 整合Mybatis-Spring方式二
###### tags: `Spring-Mybatis`

```xml=
    <bean id="userMapper2" class="com.kuang.mapper.UserMapperImpl2">
<!--給SqlSessionDaoSupport的父類注入-->
        <property name="sqlSessionFactory" ref="sqlSessionFactory"/>
    </bean>
```

```java=
public class UserMapperImpl2 extends SqlSessionDaoSupport implements UserMapper{
    @Override
    public List<User> selectUser() {
        return getSqlSession().getMapper(UserMapper.class).selectUser();
    }
}
```