提交 9db6b420 编写于 作者: 如梦技术's avatar 如梦技术 🐛

联合 mica-redis 方便使用。

上级 96f6efb0
......@@ -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
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>mica-weixin-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>mica-weixin-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mica-weixin-demo</name>
<description>Demo project for Spring Boot</description>
<name>mica-weixin-demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!-- <version>1.5.12.RELEASE</version>-->
<version>2.2.6.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!-- <version>1.5.12.RELEASE</version>-->
<version>2.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>spring-boot-starter-weixin</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-weixin</artifactId>
<version>2.0.0</version>
</dependency>
<!-- redis 存储 weixin,可选依赖 -->
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-redis</artifactId>
<version>2.0.3-GA</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
</project>
......@@ -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);
}
......
......@@ -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
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册