From 7965878e51fa249fda34eadfc3be9188dd10f3d9 Mon Sep 17 00:00:00 2001 From: Raod <1130305001@qq.com> Date: Fri, 19 Aug 2022 10:42:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=95=E5=B1=82=E9=87=87=E7=94=A8redis?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report-core/README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/report-core/README.md b/report-core/README.md index 0ad3e4fb..56e22eed 100644 --- a/report-core/README.md +++ b/report-core/README.md @@ -1 +1,41 @@ ## 后端springboot + +### 采用redis缓存 + +#### 1.pom文件 +```java + + com.anji-plus + spring-boot-gaea + 2.0.3.RELEASE + + + org.springframework.boot + spring-boot-starter-data-redis + + + +``` +删除exclusions内容,因为底层默认支持redis +删除ehcache相关依赖 + +#### 2.删除 package com.anjiplus.template.gaea.business.cache +CacheHelper底层默认实现为RedisCacheHelper。 +@ConditionalOnMissingBean 注解起到的作用 +```java +package com.anji.plus.gaea; + +@Configuration +@EnableConfigurationProperties({GaeaProperties.class}) +public class GaeaAutoConfiguration { + @Bean + @ConditionalOnClass({RedisAutoConfiguration.class}) + @ConditionalOnMissingBean + public CacheHelper cacheHelper() { + return new RedisCacheHelper(); + } +} +``` + +#### 3.bootstrap.yml加上对应的redis配置即可 +