mybatis 注解配置
来源:互联网 发布:windows update安装慢 编辑:程序博客网 时间:2024/06/05 20:12
mapper.java
public interface StudentMapper {
@Select("select * from student where id = #{id} and name = #{name}")
List<Student> getById(@Param("id")int id,@Param("name")String name);
@Select("select * from student where date > #{date} and id = #{id}")
Student getByID1(Student student);
}
applicationContext.xml
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://127.0.0.1:3306/test?characterEncoding=UTF-8" />
<property name="password" value="root" />
<property name="username" value="root" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- 引入mybatis配置文件 -->
<!-- <property name="configLocation" value="classpath:mybatis-Config.xml"></property> -->
</bean>
<!-- 注册mybatis映射器 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactory" ref="sqlSessionFactory"/>
<!-- 对应mapper类所在包 -->
<property name="basePackage" value="com.mapper"/>
</bean>
- mybatis 注解配置
- mybatis配置mapper注解
- Mybatis使用 注解配置
- MyBatis Spring 注解事务配置
- 使用注解来配置MyBatis
- mybatis系列十一:mybatis注解配置
- 整合mybatis和spring,配置spring注解
- 基于注解配置简单的SpringMVC+Mybatis
- spring4+mybatis 配置注解装载bean
- 【MyBatis学习18】使用注解配置Mapper
- mybatis注解配置缓存的方法
- Spring SpringMVC Mybatis 全注解配置
- spring boot:配置mybatis以及注解事务
- spring、springmvc、mybatis整合配置(注解)
- springboot中使用Mybatis注解配置详解
- spring注解方式配置mybatis数据源
- mybatis 注解
- mybatis注解
- 封禁USB、禁止USB、封掉USB、停用USB端口的方法
- hdu 4717 The Moving Points(三分,4级)
- ubuntu9.04最新在线更新源sources.list (经测可用2013.9.11)
- 两步验证之后我的android手机账号登陆不了
- 经典数字信号处理图书的个人评述ZZ
- mybatis 注解配置
- 厚积薄发
- AIX 常用命令汇总(二)
- Cocos2d-x 分辨率自适应解决方案
- ios聊天窗口 图文混排
- redhat Linux 安装wireshark
- vim常用操作整理
- 如何编写高质量的代码——来自《代码大全(第2版)》的启示
- 最长回文串O(n)算法 hdu3068