spring boot实践1----集成 ehcache

前段时间负责把公司用的到mvc 升级成 spring boot,此处来记录下实践中的问题

1.spring boot集成 ehcache

1)添加ehcache缓存文件

2)application.properties配置缓存路径及类型

spring.cache.ehcache.config=classpath:ehcache.xml

spring.cache.type=ehcache

3)启动项目添加@EnableCaching注解 ,引入依赖

    net.sf.ehcache

    ehcache

    org.springframework.boot

    spring-boot-starter-cache

4)在需要缓存的地方引用注解,标识出cacheName=users即可

你可能感兴趣的:(spring boot实践1----集成 ehcache)