![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring+mybatis
mobile18600007978
活到老学到老,分享已知,学习未知;
且行且思考,且行且总结
展开
-
spring与mybatis三种整合方法
本文主要介绍Spring与Mybatis三种常用整合方法,需要的整合架包是mybatis-spring.jar,可通过链接http://code.google.com/p/mybatis/下载到。 1、采用数据映射器(MapperFactoryBean)的方式,不用写mybatis映射文件,采用注解方式提供相应的sql语句和输入参数。 (1)Spring配置文件:J转载 2016-10-18 15:20:58 · 204 阅读 · 0 评论 -
Spring InitializingBean的afterPropertiesSet方法
Spring InitializingBean的afterPropertiesSet方法org.springframework.beans.factory包下有一个接口是InitializingBean 只有一个方法: void afterPropertiesSet() throws Exception;这个方法将在所有的属性被初始化后调用。但是会在init前调原创 2017-07-05 17:01:24 · 1151 阅读 · 0 评论 -
MyBatis批量插入数据
在程序中封装了一个List集合对象,然后需要把该集合中的实体插入到数据库中,由于项目使用了Spring+MyBatis的配置,所以打算使用MyBatis批量插入,由于之前没用过批量插入,在网上找了一些资料后最终实现了,把详细过程贴出来。 实体类TrainRecord结构如下: Java代码 public class TrainRecord im转载 2017-08-16 20:50:31 · 346 阅读 · 0 评论 -
导出文件Content-Type: application/vnd.ms-excel
Content-Type: application/vnd.ms-excel">如果要将查询结果导出到Excel,只需将页面的Context-Type修改一下就可以了: header( "Content-Type: application/vnd.ms-excel">如果希望能够提供那个打开/保存的对话框,Content-Disposition参数,Content-Disp...转载 2018-08-02 21:24:45 · 23216 阅读 · 0 评论 -
spring整合mybatis自动生成dao层文件的操作流程(二)
首先spring整合mybatis在(一)中说过,那么下面说一下如何自动生成dao、pojo、mapperxml文件第一步、在pom.xml中增加一个插件,意义在于手动执行maven的操作: <plugin> <groupId>org.mybatis.generator</groupId> &l...原创 2019-03-31 14:35:26 · 277 阅读 · 0 评论 -
spring整合mybatis的操作流程(一)
首先spring整合mybatis需要在pom.xml中引入两个坐标:<properties> <mybatis-spring.version>1.2.2</mybatis-spring.version> <mybatis.version>3.2.3</mybatis.version></properties&...原创 2019-03-31 17:36:25 · 343 阅读 · 0 评论 -
springMVC工程中加入druid数据池的监控(一)
首先在maven工程,pom.xml中增加依赖: <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.0</version> <...原创 2019-04-02 11:49:02 · 2613 阅读 · 0 评论 -
springboot工程中加入druid数据池的监控(二)
Druid是Java语言中最好的数据库连接池,能够提供强大的sql监控和扩展功能。业界把 Druid 和 HikariCP 做对比后,虽说 HikariCP 的性能比 Druid 高,但是因为 Druid 包括很多维度的统计和分析功能,所以这也是大家都选择使用它的原因。首先在maven工程pom.xml中增加:<!-- druid数据连接池 --><dependency&g...原创 2019-04-02 13:59:08 · 213 阅读 · 0 评论