尝试自动装配ClientResources时出现问题

时间:2018-06-13 18:11:42

标签: spring-boot redis lettuce

我正在尝试自动装载ClientResources,如下所示:

@Bean(destroyMethod = "shutdown") 
public ClientResources clientResources() { 
      final ClientResources res = DefaultClientResources.create(); 
      return res; 
}

但我面临以下问题:

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientResources' defined in class path resource [com/xxx/xxx/xxx/configuration/CacheLettuceConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.lettuce.core.resource.ClientResources]: Factory method 'clientResources' threw exception; nested exception is java.lang.NoClassDefFoundError: reactor/core/scheduler/Schedulers

有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

我添加了以下依赖项:

<dependency>
    <groupId>io.projectreactor</groupId>
    <artifactId>reactor-core</artifactId>
    <version>3.1.8.RELEASE</version>
</dependency>

现在一切都还好。