diff --git a/cms/cms-dao/src/main/resources/applicationContext-jdbc.xml b/cms/cms-dao/src/main/resources/applicationContext-jdbc.xml
index f9ea1090af7511dc18dcc2019876c82df3b111f4..6a4574c9a2f24a769751da7810557e524f289b31 100644
--- a/cms/cms-dao/src/main/resources/applicationContext-jdbc.xml
+++ b/cms/cms-dao/src/main/resources/applicationContext-jdbc.xml
@@ -61,5 +61,5 @@
-
+
\ No newline at end of file
diff --git a/cms/cms-service/src/test/java/com/zheng/cms/service/UserServiceTest.java b/cms/cms-service/src/test/java/com/zheng/cms/service/UserServiceTest.java
index 543dd227eee57cc180fbad971ca7cf87d6550073..ee74e5d859e6771ace4fe581b36cfca6d602ca05 100644
--- a/cms/cms-service/src/test/java/com/zheng/cms/service/UserServiceTest.java
+++ b/cms/cms-service/src/test/java/com/zheng/cms/service/UserServiceTest.java
@@ -2,6 +2,9 @@ package com.zheng.cms.service;
import com.zheng.cms.model.User;
import com.zheng.cms.model.UserVO;
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -17,7 +20,8 @@ import org.springframework.test.context.transaction.TransactionConfiguration;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({
"classpath:applicationContext.xml",
- "classpath:applicationContext-jdbc.xml"
+ "classpath:applicationContext-jdbc.xml",
+ "classpath:applicationContext-ehcache.xml"
})
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
public class UserServiceTest {
@@ -33,6 +37,27 @@ public class UserServiceTest {
// 自动生成接口调用
User user = userService.getMapper().selectByPrimaryKey(1);
System.out.println(null == user ? "null" :user.getNickname());
+
+ // Create a cache manager
+ final CacheManager cacheManager = CacheManager.getInstance();
+
+ // create the cache called "hello-world"
+ final Cache cache = cacheManager.getCache("ehCache");
+
+ // create a key to map the data to
+ final String key = "key";
+
+ // Create a data element
+ final Element element = new Element(key, "value");
+
+ // Put the element into the data store
+ cache.put(element);
+
+ // Retrieve the data element
+ final Element cacheElement = cache.get(key);
+
+ // Print the value
+ System.out.println(cacheElement.getObjectValue());
}
}
diff --git a/cms/cms-web/src/main/webapp/WEB-INF/web.xml b/cms/cms-web/src/main/webapp/WEB-INF/web.xml
index a5c07cdab27f4545832b2902e7cfaa4aa462047d..5c2b7322177501bb6a93ea968f55c832c680afef 100644
--- a/cms/cms-web/src/main/webapp/WEB-INF/web.xml
+++ b/cms/cms-web/src/main/webapp/WEB-INF/web.xml
@@ -28,7 +28,8 @@
contextConfigLocation
classpath:applicationContext.xml,
- classpath:applicationContext-jdbc.xml
+ classpath:applicationContext-jdbc.xml,
+ classpath:applicationContext-ehcache.xml
diff --git a/common/pom.xml b/common/pom.xml
index 4748647f47deb5088c853afd2791d69240f1276f..903218cbc101b55b9b78b52a816fee528775d5cb 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -27,7 +27,7 @@
org.springframework
- spring-context
+ spring-context-support
${spring.version}
@@ -61,15 +61,11 @@
pagehelper
4.1.6
+
- org.mybatis
- mybatis-ehcache
- 1.0.0
-
-
- org.ehcache
+ net.sf.ehcache
ehcache
- 3.1.3
+ 2.10.0
diff --git a/common/src/main/resources/applicationContext-ehcache.xml b/common/src/main/resources/applicationContext-ehcache.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e2e249626b8dffce08abd2c4afb58bfed5a37755
--- /dev/null
+++ b/common/src/main/resources/applicationContext-ehcache.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/resources/applicationContext.xml b/common/src/main/resources/applicationContext.xml
index 98a4e40142d03bb8ff311bd5c86449a01a8b251e..b4066747324712542cbf08c07c4cd9e3e0ec4b9d 100644
--- a/common/src/main/resources/applicationContext.xml
+++ b/common/src/main/resources/applicationContext.xml
@@ -1,18 +1,12 @@
+ http://www.springframework.org/schema/context/spring-context.xsd">
diff --git a/common/src/main/resources/ehcache.xml b/common/src/main/resources/ehcache.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f472c4f842b7e55e601046759bab9796319d020d
--- /dev/null
+++ b/common/src/main/resources/ehcache.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file