依赖
<jdk.version>1.8</jdk.version>
<spring.version>5.1.3.RELEASE</spring.version>
<hibernate.version>5.4.0.Final</hibernate.version>
<hibernate.jpa.version>1.0.0.Final</hibernate.jpa.version><!—未改动–>
<jackson.version>2.9.6</jackson.version>
org.springframework
spring-webmvc
${spring.version}
org.springframework
spring-context
${spring.version}
org.springframework
spring-context-support
${spring.version}
org.springframework
spring-beans
${spring.version}
org.springframework
spring-orm
${spring.version}
org.springframework
spring-jdbc
${spring.version}
org.springframework
spring-tx
${spring.version}
org.springframework
spring-test
${spring.version}
test
org.hibernate
hibernate-core
${hibernate.version}
org.hibernate
hibernate-entitymanager
${hibernate.version}
org.hibernate
hibernate-ehcache
${hibernate.version}
net.sf.ehcache
ehcache-core
org.hibernate.javax.persistence
hibernate-jpa-2.1-api
${hibernate.jpa.version}
com.github.ben-manes.caffeine
caffeine
2.6.2
org.springframework
spring-context-support
配置:application.xml
注解:
在需要开启缓存的类加上@EnableCaching注解
在方法上加上@Cacheable(value = “gg”)注解