redisson 分布式锁 BUG修复

v1.4.1
Parker 4 years ago
parent 2230591f9e
commit e9746ee9af

@ -23,13 +23,14 @@ import org.springframework.stereotype.Component;
@Slf4j
public class DistributedLockHandler {
@Autowired
@Autowired(required = false)
private RedissonLock redissonLock;
@Around("@annotation(distributedLock)")
public Object around(ProceedingJoinPoint joinPoint, DistributedLock distributedLock) {
public Object around(ProceedingJoinPoint joinPoint, DistributedLock distributedLock) throws Throwable {
Object returnValue = null;
if(redissonLock != null){
log.info("[开始]执行RedisLock环绕通知,获取Redis分布式锁开始");
//获取锁名称
String lockName = distributedLock.value();
@ -49,6 +50,9 @@ public class DistributedLockHandler {
}
}
log.info("释放Redis分布式锁[成功],解锁完成,结束业务逻辑...");
}else {
returnValue = joinPoint.proceed();
}
return returnValue;
}

@ -34,8 +34,8 @@ import org.springframework.core.annotation.Order;
*/
@Slf4j
@Configuration
@ConditionalOnProperty(prefix = RedissonProperties.PROP_PREFIX, name = "enable", havingValue = "true")
@EnableConfigurationProperties(RedissonProperties.class)
@ConditionalOnProperty(prefix = RedissonProperties.PROP_PREFIX, name = "enable", havingValue = "true")
public class RedissonConfig {
@Bean

@ -2,6 +2,7 @@ package org.opsli.plugins.redisson.properties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.opsli.plugins.redisson.enums.RedissonType;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ -16,6 +17,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class RedissonProperties {
public static final String PROP_PREFIX = "redisson.lock.server";

Loading…
Cancel
Save