集成 mybatis-ehcache

This commit is contained in:
shuzheng 2016-10-19 16:55:13 +08:00
parent a672de4a43
commit cccdac47b5
2 changed files with 24 additions and 12 deletions

View File

@ -12,12 +12,19 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
<spring.version>4.1.7.RELEASE</spring.version>
<mybatis.version>3.2.7</mybatis.version>
<mybatis-spring.version>1.2.3</mybatis-spring.version>
<spring.version>4.3.3.RELEASE</spring.version>
<spring-security.version>4.1.3.RELEASE</spring-security.version>
<mybatis.version>3.4.1</mybatis.version>
<mybatis-spring.version>1.3.0</mybatis-spring.version>
<mybatis-generator.version>1.3.5</mybatis-generator.version>
<mybatis-ehcache.version>1.0.0</mybatis-ehcache.version>
<ehcache.version>2.10.0</ehcache.version>
</properties>
<dependencies>
@ -52,12 +59,12 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.1.3.RELEASE</version>
<version>${spring-security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.1.3.RELEASE</version>
<version>${spring-security.version}</version>
</dependency>
<!-- mybatis -->
<dependency>
@ -73,13 +80,18 @@
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.5</version>
<version>${mybatis-generator.version}</version>
</dependency>
<!-- 缓存 -->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.10.0</version>
<version>${ehcache.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-ehcache</artifactId>
<version>${mybatis-ehcache.version}</version>
</dependency>
<!-- 数据库 -->
<dependency>

View File

@ -11,14 +11,14 @@
<!-- 支持缓存注解 -->
<cache:annotation-driven cache-manager="cacheManager" />
<!-- cache管理器配置 -->
<bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:ehcache.xml"/>
</bean>
<!-- 默认是cacheManager -->
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
<property name="cacheManager" ref="cacheManagerFactory"/>
</bean>
<!-- cache管理器配置 -->
<bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:ehcache.xml"/>
</bean>
</beans>