diff --git a/continew-starter-auth/continew-starter-auth-justauth/src/main/java/top/charles7c/continew/starter/auth/justauth/autoconfigure/JustAuthAutoConfiguration.java b/continew-starter-auth/continew-starter-auth-justauth/src/main/java/top/charles7c/continew/starter/auth/justauth/autoconfigure/JustAuthAutoConfiguration.java index 32b2050a..3477f6b8 100644 --- a/continew-starter-auth/continew-starter-auth-justauth/src/main/java/top/charles7c/continew/starter/auth/justauth/autoconfigure/JustAuthAutoConfiguration.java +++ b/continew-starter-auth/continew-starter-auth-justauth/src/main/java/top/charles7c/continew/starter/auth/justauth/autoconfigure/JustAuthAutoConfiguration.java @@ -19,7 +19,9 @@ package top.charles7c.continew.starter.auth.justauth.autoconfigure; import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import me.zhyd.oauth.cache.AuthStateCache; +import org.redisson.client.RedisClient; import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import top.charles7c.continew.starter.auth.justauth.impl.JustAuthStateCacheRedisImpl; @@ -31,7 +33,7 @@ import top.charles7c.continew.starter.auth.justauth.impl.JustAuthStateCacheRedis * @since 1.0.0 */ @Slf4j -@AutoConfiguration(after = com.xkcoding.justauth.autoconfigure.JustAuthAutoConfiguration.class) +@AutoConfiguration(before = com.xkcoding.justauth.autoconfigure.JustAuthAutoConfiguration.class) @ConditionalOnProperty(prefix = "justauth", value = "enabled", havingValue = "true", matchIfMissing = true) public class JustAuthAutoConfiguration { @@ -39,9 +41,12 @@ public class JustAuthAutoConfiguration { * 自定义 State 缓存实现 */ @Bean - @ConditionalOnProperty(prefix = "justauth.cache", value = "type", havingValue = "custom") + @ConditionalOnClass(RedisClient.class) + @ConditionalOnProperty(prefix = "justauth.cache", value = "type", havingValue = "redis") public AuthStateCache authStateCache() { - return new JustAuthStateCacheRedisImpl(); + JustAuthStateCacheRedisImpl impl = new JustAuthStateCacheRedisImpl(); + log.debug("[ContiNew Starter] - Auto Configuration 'JustAuth-AuthStateCache-Redis' completed initialization."); + return impl; } @PostConstruct diff --git a/continew-starter-auth/continew-starter-auth-justauth/src/main/java/top/charles7c/continew/starter/auth/justauth/impl/JustAuthStateCacheRedisImpl.java b/continew-starter-auth/continew-starter-auth-justauth/src/main/java/top/charles7c/continew/starter/auth/justauth/impl/JustAuthStateCacheRedisImpl.java index f759d558..4676cfe4 100644 --- a/continew-starter-auth/continew-starter-auth-justauth/src/main/java/top/charles7c/continew/starter/auth/justauth/impl/JustAuthStateCacheRedisImpl.java +++ b/continew-starter-auth/continew-starter-auth-justauth/src/main/java/top/charles7c/continew/starter/auth/justauth/impl/JustAuthStateCacheRedisImpl.java @@ -22,7 +22,7 @@ import top.charles7c.continew.starter.cache.redisson.util.RedisUtils; import java.time.Duration; /** - * Just Auth 自定义 State 缓存实现(Redis) + * JustAuth State 缓存 Redis 实现 * * @author Charles7c * @since 1.0.0 diff --git a/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/autoconfigure/SaTokenDaoConfiguration.java b/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/autoconfigure/SaTokenDaoConfiguration.java index aac7b864..4a41672c 100644 --- a/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/autoconfigure/SaTokenDaoConfiguration.java +++ b/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/autoconfigure/SaTokenDaoConfiguration.java @@ -38,7 +38,7 @@ import top.charles7c.continew.starter.cache.redisson.autoconfigure.RedissonAutoC */ @Slf4j @NoArgsConstructor(access = AccessLevel.PRIVATE) -public abstract class SaTokenDaoConfiguration { +abstract class SaTokenDaoConfiguration { /** * 自定义持久层实现类-Redis