---
title: "spring mvc+ mybaties+ehcache(maven工程)，在mapper.xml中使用"
author: "张-浩东"
date: "2016-02-02T15:29:10Z"
tags: ["Cache", "MVC", "Spring", "maven"]
categories: ["企业架构"]
slug: "spring-mvc-mybaties-ehcache-maven-mapper-xml"
draft: false
lastmod: "2016-02-02T15:29:10Z"
id: 2275461
url: "https://937033211.iteye.com/blog/2275461"
---

参考网站： http://www.tuicool.com/articles/myeANv http://my.oschina.net/u/1469930/blog/388004 第一步： 在porm.xml文件中引入需要引进的jar包 org.mybatis mybatis-ehcache 1.0.0 org.ehcache ehcache 3.0.0.m3 第二步： 在根路径下创建ehcache.xml文件 第三步： 在spring-mybaties.xml中添加下面的代码 第四步： 测试 @RequestMapping("test") public void test(){ long beginTime=System.nanoTime(); Demo demo = demoMapper.selectByPrimaryKey(1L); long endTime=System.nanoTime(); System.out.println("查询时间 :" + (endTime-beginTime)+"ns"); }