fix:使用一键改包之后,可能导致的自定义lock4j失败策略bean与lock4j提供的默认失败策略bean冲突问题

解决方法:
使用@AutoConfigureBefore注解,指定自定义bean在LockAutoConfiguration之前进行加载,使得LockAutoConfiguration中的失败策略bean上的@ConditionalOnMissingBean注解生效
This commit is contained in:
baihongbin 2022-05-11 02:51:29 +00:00 committed by Gitee
parent 8505873e1b
commit 9d5d192175
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -1,12 +1,15 @@
package cn.iocoder.yudao.framework.lock4j.config; package cn.iocoder.yudao.framework.lock4j.config;
import cn.hutool.core.util.ClassUtil; import cn.hutool.core.util.ClassUtil;
import com.baomidou.lock.spring.boot.autoconfigure.LockAutoConfiguration;
import cn.iocoder.yudao.framework.lock4j.core.DefaultLockFailureStrategy; import cn.iocoder.yudao.framework.lock4j.core.DefaultLockFailureStrategy;
import cn.iocoder.yudao.framework.lock4j.core.Lock4jRedisKeyConstants; import cn.iocoder.yudao.framework.lock4j.core.Lock4jRedisKeyConstants;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Configuration @Configuration
@AutoConfigureBefore(LockAutoConfiguration.class)
public class YudaoLock4jConfiguration { public class YudaoLock4jConfiguration {
static { static {