From 9db6b4205c1452f93d0089d622886ff623875f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=A2=A6=E6=8A=80=E6=9C=AF?= <596392912@qq.com> Date: Thu, 2 Jul 2020 22:23:34 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E8=81=94=E5=90=88=20mica-redis=20?= =?UTF-8?q?=E6=96=B9=E4=BE=BF=E4=BD=BF=E7=94=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- mica-weixin-demo/pom.xml | 111 +++++++++--------- .../config/DreamWeixinAutoConfiguration.java | 4 +- .../properties/DreamWeixinProperties.java | 4 +- 4 files changed, 64 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 645a3a3..2dda2d8 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ jfinal weixin 的 spring boot starter,这个starter是为了方便boot用户 ### 配置 | 配置项 | 默认值 | 说明 | | ----- | ------ | ------ | -| dream.weixin.access-token-cache | dreamWeixinCache | 缓存名,需要开启spring cache | +| dream.weixin.access-token-cache | dreamWeixinCache#7100s | 缓存名,需要开启spring cache | | dream.weixin.app-id-key | appId | 多公众号参数名,如:/weixin/wx?appId=xxx | | dream.weixin.dev-mode | false | 开发模式 | | dream.weixin.url-patterns | /weixin/* | weixin 消息处理spring拦截器url前缀 | @@ -68,6 +68,8 @@ dream: ## 更新说明 ### 2020-07-05 v2.0.0 - 改名为 mica-weixin,提升 mica 品牌。 +- 内置 @EnableCaching。 +- 更改缓存名为 `dreamWeixinCache#7100s`,方便和 `mica-redis` 一起使用。 - 升级 jfinal、jfinal-weixin 版本。 ### 2020-05-01 v1.4.0 diff --git a/mica-weixin-demo/pom.xml b/mica-weixin-demo/pom.xml index 54a4d8f..c5dcbbd 100644 --- a/mica-weixin-demo/pom.xml +++ b/mica-weixin-demo/pom.xml @@ -1,61 +1,66 @@ - 4.0.0 - com.example - mica-weixin-demo - 0.0.1-SNAPSHOT - jar + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + com.example + mica-weixin-demo + 0.0.1-SNAPSHOT + jar - mica-weixin-demo - Demo project for Spring Boot + mica-weixin-demo + Demo project for Spring Boot - - org.springframework.boot - spring-boot-starter-parent - - 2.2.6.RELEASE - - + + org.springframework.boot + spring-boot-starter-parent + + 2.3.1.RELEASE + + - - UTF-8 - UTF-8 - 1.8 - + + UTF-8 + UTF-8 + 1.8 + - - - org.springframework.boot - spring-boot-starter-web - - - net.dreamlu - spring-boot-starter-weixin - 1.4.0 - - - org.springframework.boot - spring-boot-devtools - true - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - true - - - - + + + org.springframework.boot + spring-boot-starter-web + + + net.dreamlu + mica-weixin + 2.0.0 + + + + net.dreamlu + mica-redis + 2.0.3-GA + + + org.springframework.boot + spring-boot-devtools + true + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + diff --git a/mica-weixin/src/main/java/net/dreamlu/weixin/config/DreamWeixinAutoConfiguration.java b/mica-weixin/src/main/java/net/dreamlu/weixin/config/DreamWeixinAutoConfiguration.java index ed83ae7..e95c7c8 100644 --- a/mica-weixin/src/main/java/net/dreamlu/weixin/config/DreamWeixinAutoConfiguration.java +++ b/mica-weixin/src/main/java/net/dreamlu/weixin/config/DreamWeixinAutoConfiguration.java @@ -20,13 +20,11 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter */ @Configuration @EnableCaching -@RequiredArgsConstructor @EnableConfigurationProperties(DreamWeixinProperties.class) public class DreamWeixinAutoConfiguration { - private final CacheManager cacheManager; @Bean - public SpringAccessTokenCache springAccessTokenCache(DreamWeixinProperties properties) { + public SpringAccessTokenCache springAccessTokenCache(CacheManager cacheManager, DreamWeixinProperties properties) { Cache cache = cacheManager.getCache(properties.getAccessTokenCache()); return new SpringAccessTokenCache(cache); } diff --git a/mica-weixin/src/main/java/net/dreamlu/weixin/properties/DreamWeixinProperties.java b/mica-weixin/src/main/java/net/dreamlu/weixin/properties/DreamWeixinProperties.java index 2c288e4..f4d81dc 100644 --- a/mica-weixin/src/main/java/net/dreamlu/weixin/properties/DreamWeixinProperties.java +++ b/mica-weixin/src/main/java/net/dreamlu/weixin/properties/DreamWeixinProperties.java @@ -29,9 +29,9 @@ public class DreamWeixinProperties { */ private boolean devMode = false; /** - * Spring cache name,需要开启spring cache,默认:dreamWeixinCache + * Spring cache name,需要开启spring cache,默认:dreamWeixinCache#7100s */ - private String accessTokenCache = "dreamWeixinCache"; + private String accessTokenCache = "dreamWeixinCache#7100s"; /** * 多公众号url挂参,默认:appId */ -- GitLab