dromara / Sa-Token

一个轻量级 Java 权限认证框架,让鉴权变得简单、优雅!—— 登录认证、权限认证、分布式Session会话、微服务网关鉴权、单点登录、OAuth2.0
https://sa-token.cc
Apache License 2.0
16.68k stars 2.62k forks source link

'cn.dev33.satoken.dao.alone.SaAloneRedisInject': io/lettuce/core/ClientOptions #710

Open bruce-pang opened 21 hours ago

bruce-pang commented 21 hours ago

使用版本:

sa-token-alone-redis:1.39.0

报错信息:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cn.dev33.satoken.dao.alone.SaAloneRedisInject': io/lettuce/core/ClientOptions at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:606) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:959) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) at com.jikongmro.bulk.server.JkServerApplication.main(JkServerApplication.java:26) Caused by: java.lang.NoClassDefFoundError: io/lettuce/core/ClientOptions at org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration$LettuceClientConfigurationBuilder.(LettuceClientConfiguration.java:172) at org.springframework.data.redis.connection.lettuce.LettucePoolingClientConfiguration$LettucePoolingClientConfigurationBuilder.(LettucePoolingClientConfiguration.java:97) at org.springframework.data.redis.connection.lettuce.LettucePoolingClientConfiguration.builder(LettucePoolingClientConfiguration.java:51) at cn.dev33.satoken.dao.alone.SaAloneRedisInject.setEnvironment(SaAloneRedisInject.java:195) at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:94) at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:87) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:421) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1765) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ... 15 common frames omitted Caused by: java.lang.ClassNotFoundException: io.lettuce.core.ClientOptions at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) ... 24 common frames omitted

希望结果:

复现步骤:

在jdk17+springboot3.2.2环境中 在Spring配置文件添加如下配置

maven的配置包如下:


           <properties>
                <java.version>17</java.version>
                <sa-token.version>1.39.0</sa-token.version>
                <redisson.version>3.26.0</redisson.version>
           </properties>
            <dependency>
                <groupId>cn.dev33</groupId>
                <artifactId>sa-token-spring-boot3-starter</artifactId>
                <version>${sa-token.version}</version>
            </dependency>

            <dependency>
                <groupId>cn.dev33</groupId>
                <artifactId>sa-token-core</artifactId>
                <version>${sa-token.version}</version>
            </dependency>

            <dependency>
                <groupId>cn.dev33</groupId>
                <artifactId>sa-token-redis</artifactId>
                <version>${sa-token.version}</version>
            </dependency>

            <dependency>
                <groupId>cn.dev33</groupId>
                <artifactId>sa-token-alone-redis</artifactId>
                <version>${sa-token.version}</version>
            </dependency>

            <dependency>
                <groupId>com.jikongmro.bulk</groupId>
                <artifactId>jk-spring-boot-starter-redis</artifactId>
                <version>${revision}</version>
            </dependency>

            <dependency>
                <groupId>org.redisson</groupId>
                <artifactId>redisson-spring-boot-starter</artifactId>
                <version>${redisson.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-actuator</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

```yaml
# saToken配置
sa-token:
  # 是否输出操作日志
  is-log: true
  alone-redis:
    database: 14
    host: 192.168.122.1
    port: 6379
    password: 123456
    timeout: 10
    lettuce:
      pool:
        max-active: 50       # 最大连接数
        max-idle: 10         # 最大空闲连接数
        min-idle: 5          # 最小空闲连接数
        max-wait: 2000ms     # 连接池最大等待时间

启动项目报错上述错误,
< 备注:如果复现步骤比较复杂,请将 demo 上传到 gitee 并留下地址 >
bruce-pang commented 21 hours ago

项目中所有涉及到的satoken依赖如图 image