diff --git a/CHANGELOG.md b/CHANGELOG.md index 18ef1b4..a2736fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,3 +53,9 @@ | 1 | A | 添加 keyFormat | 2022-12-8 14:45:40 | | | 2 | A | 添加锁释放失败 | 2022-12-8 14:45:40 | | | 3 | O | 加锁处理优化,接口统一优化 | 2022-12-8 14:45:40 | | + +# release_1.3.0 + +| 序号 | 变更类型 | 说明 | 时间 | 备注 | +|:---|:---|:---|:---|:--| +| 1 | A | 让 redis-config 主动启用,避免无法主动管理的情况 | 2022-12-8 14:45:40 | | diff --git a/README.md b/README.md index 9a82742..6af2a50 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,12 @@ - 基于 redis 的分布式锁 +- 内置支持多种 redis 的整合方式 + - 整合 spring - 整合 spring-boot -- 支持多种 redis 的整合方式 - # 变更日志 > [变更日志](CHANGELOG.md) @@ -36,7 +36,7 @@ maven 3.x+ com.github.houbb lock-core - 1.2.0 + 1.3.0 ``` @@ -83,7 +83,7 @@ LockBs.newInstance() com.github.houbb lock-spring - 1.2.0 + 1.3.0 ``` @@ -93,10 +93,13 @@ LockBs.newInstance() `@EnableLock` 启用分布式锁。 +`@EnableRedisConfig` 启用 redis 的默认配置。 + ```xml @Configurable @ComponentScan(basePackages = "com.github.houbb.lock.test.service") @EnableLock +@EnableRedisConfig public class SpringConfig { } ``` @@ -109,7 +112,6 @@ public @interface EnableLock { /** * 唯一标识生成策略 * @return 结果 - * @since 1.1.0 */ String id() default "lockId"; @@ -119,21 +121,18 @@ public @interface EnableLock { * 默认引入 redis-config 中的配置 * * @return 实现 - * @since 1.1.0 */ String cache() default "springRedisService"; /** * 加锁 key 格式化策略 * @return 策略 - * @since 1.2.0 */ String lockKeyFormat() default "lockKeyFormat"; /** * 锁释放失败处理类 * @return 结果 - * @since 1.2.0 */ String lockReleaseFailHandler() default "lockReleaseFailHandler"; @@ -142,7 +141,7 @@ public @interface EnableLock { 其中 `springRedisService` 使用的是 [redis-config](https://github.com/houbb/redis-config) 中的实现。 -redis 的配置信息如下: +对应注解 `@EnableRedisConfig`,redis 的配置信息如下: | 配置 | 说明 | 默认值 |:---|:---|:----| @@ -219,21 +218,18 @@ public @interface Lock { /** * 时间单位 * @return 单位 - * @since 1.2.0 */ TimeUnit timeUnit() default TimeUnit.SECONDS; /** * 等待锁时间 * @return 等待锁时间 - * @since 1.2.0 */ long waitLockTime() default 10; /** * 业务加锁时间 * @return 加锁时间 - * @since 1.2.0 */ long lockTime() default 60; @@ -248,7 +244,7 @@ public @interface Lock { com.github.houbb lock-springboot-starter - 1.2.0 + 1.3.0 ``` diff --git a/lock-api/pom.xml b/lock-api/pom.xml index 35bfa05..c5e55e2 100644 --- a/lock-api/pom.xml +++ b/lock-api/pom.xml @@ -5,7 +5,7 @@ lock com.github.houbb - 1.2.0 + 1.3.0 4.0.0 diff --git a/lock-core/pom.xml b/lock-core/pom.xml index 8a9d1bd..6b6fa08 100644 --- a/lock-core/pom.xml +++ b/lock-core/pom.xml @@ -5,7 +5,7 @@ lock com.github.houbb - 1.2.0 + 1.3.0 4.0.0 diff --git a/lock-spring/pom.xml b/lock-spring/pom.xml index bce38ac..bf6f575 100644 --- a/lock-spring/pom.xml +++ b/lock-spring/pom.xml @@ -5,7 +5,7 @@ lock com.github.houbb - 1.2.0 + 1.3.0 4.0.0 diff --git a/lock-spring/src/main/java/com/github/houbb/lock/spring/config/CommonCacheConfig.java b/lock-spring/src/main/java/com/github/houbb/lock/spring/config/CommonCacheConfig.java deleted file mode 100644 index cf20156..0000000 --- a/lock-spring/src/main/java/com/github/houbb/lock/spring/config/CommonCacheConfig.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.github.houbb.lock.spring.config; - -import com.github.houbb.redis.config.spring.annotation.EnableRedisConfig; -import org.springframework.context.annotation.Configuration; - -/** - * bean 配置 - * - * @author binbin.hou - * @since 0.0.2 - */ -@Configuration -@EnableRedisConfig -public class CommonCacheConfig { - -} diff --git a/lock-spring/src/main/java/com/github/houbb/lock/spring/config/LockAopConfig.java b/lock-spring/src/main/java/com/github/houbb/lock/spring/config/LockAopConfig.java index a56d9a1..b1d184c 100644 --- a/lock-spring/src/main/java/com/github/houbb/lock/spring/config/LockAopConfig.java +++ b/lock-spring/src/main/java/com/github/houbb/lock/spring/config/LockAopConfig.java @@ -1,16 +1,12 @@ package com.github.houbb.lock.spring.config; import com.github.houbb.common.cache.api.service.ICommonCacheService; -import com.github.houbb.heaven.util.lang.StringUtil; import com.github.houbb.id.api.Id; -import com.github.houbb.id.core.core.Ids; import com.github.houbb.lock.api.core.ILockKeyFormat; import com.github.houbb.lock.api.core.ILockReleaseFailHandler; import com.github.houbb.lock.core.bs.LockBs; import com.github.houbb.lock.spring.annotation.EnableLock; -import com.github.houbb.redis.config.core.factory.JedisRedisServiceFactory; import org.springframework.beans.BeansException; -import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.annotation.*; @@ -25,7 +21,7 @@ import org.springframework.core.type.AnnotationMetadata; */ @Configuration @ComponentScan(basePackages = "com.github.houbb.lock.spring") -@Import({LockBeanConfig.class, CommonCacheConfig.class}) +@Import({LockBeanConfig.class}) public class LockAopConfig implements ImportAware, BeanFactoryPostProcessor { @Bean("lockBs") diff --git a/lock-springboot-starter/pom.xml b/lock-springboot-starter/pom.xml index f790f0c..464975d 100644 --- a/lock-springboot-starter/pom.xml +++ b/lock-springboot-starter/pom.xml @@ -5,7 +5,7 @@ lock com.github.houbb - 1.2.0 + 1.3.0 4.0.0 @@ -17,9 +17,15 @@ lock-spring + + com.github.houbb + redis-config-springboot-starter + + org.springframework.boot spring-boot-starter + diff --git a/lock-springboot-starter/src/main/java/com/github/houbb/lock/springboot/starter/config/LockAutoConfig.java b/lock-springboot-starter/src/main/java/com/github/houbb/lock/springboot/starter/config/LockAutoConfig.java index 904fb4a..b7a65fe 100644 --- a/lock-springboot-starter/src/main/java/com/github/houbb/lock/springboot/starter/config/LockAutoConfig.java +++ b/lock-springboot-starter/src/main/java/com/github/houbb/lock/springboot/starter/config/LockAutoConfig.java @@ -1,8 +1,6 @@ package com.github.houbb.lock.springboot.starter.config; import com.github.houbb.lock.spring.annotation.EnableLock; -import com.github.houbb.lock.spring.config.LockAopConfig; -import com.github.houbb.redis.config.spring.annotation.EnableRedisConfig; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.context.annotation.Configuration; diff --git a/lock-test/pom.xml b/lock-test/pom.xml index 583d59f..625a3d3 100644 --- a/lock-test/pom.xml +++ b/lock-test/pom.xml @@ -5,7 +5,7 @@ lock com.github.houbb - 1.2.0 + 1.3.0 4.0.0 diff --git a/lock-test/src/main/java/com/github/houbb/lock/test/config/SpringConfig.java b/lock-test/src/main/java/com/github/houbb/lock/test/config/SpringConfig.java index 5001678..24e439d 100644 --- a/lock-test/src/main/java/com/github/houbb/lock/test/config/SpringConfig.java +++ b/lock-test/src/main/java/com/github/houbb/lock/test/config/SpringConfig.java @@ -2,6 +2,7 @@ package com.github.houbb.lock.test.config; import com.github.houbb.lock.spring.annotation.EnableLock; +import com.github.houbb.redis.config.spring.annotation.EnableRedisConfig; import org.springframework.beans.factory.annotation.Configurable; import org.springframework.context.annotation.ComponentScan; @@ -12,5 +13,6 @@ import org.springframework.context.annotation.ComponentScan; @Configurable @ComponentScan(basePackages = "com.github.houbb.lock.test.service") @EnableLock +@EnableRedisConfig public class SpringConfig { } diff --git a/lock-test2/pom.xml b/lock-test2/pom.xml index 0da6881..b5cac34 100644 --- a/lock-test2/pom.xml +++ b/lock-test2/pom.xml @@ -5,7 +5,7 @@ lock com.github.houbb - 1.2.0 + 1.3.0 4.0.0 diff --git a/pom.xml b/pom.xml index 14d969d..aac43f5 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.houbb lock pom - 1.2.0 + 1.3.0 lock-api lock-core @@ -123,6 +123,11 @@ redis-config-spring ${redis-config.version} + + com.github.houbb + redis-config-springboot-starter + ${redis-config.version} + diff --git a/release.bat b/release.bat index 9ed58c0..aa82bcd 100644 --- a/release.bat +++ b/release.bat @@ -10,9 +10,9 @@ ECHO "============================= RELEASE START..." :: 版本号信息(需要手动指定) :::: 旧版本名称 -SET version=1.2.0 +SET version=1.3.0 :::: 新版本名称 -SET newVersion=1.3.0 +SET newVersion=1.4.0 :::: 组织名称 SET groupName=com.github.houbb :::: 项目名称