我试图在1.5.15.RELEASE版本的spring boot项目中配置LettuceConnectionFactory .

这是我的配置文件:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisSentinelConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;

@SpringBootApplication
public class RedisApplication {

  private static final Logger LOGGER = LoggerFactory.getLogger(RedisApplication.class);

  @Bean
  public LettuceConnectionFactory lettuceConnectionFactory()
   {
      LOGGER.info("Setup lettuce config");
      final LettuceConnectionFactory factory = new LettuceConnectionFactory();
      return factory;
  }

  @Bean
  RedisTemplate<String,User> redisTemplate()
  {
    RedisTemplate<String,User> redisTemplate = new RedisTemplate<>();
    redisTemplate.setConnectionFactory(lettuceConnectionFactory());
    return redisTemplate;
  }

    public static void main(String[] args) {

        SpringApplication.run(RedisApplication.class, args);



    }

}

我在pom.xml中添加了生菜依赖

<dependency>
            <groupId>biz.paluch.redis</groupId>
            <artifactId>lettuce</artifactId>
            <version>3.5.0.Final</version>
        </dependency>

在启动项目时,它抛出错误

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lettuceConnectionFactory' defined in com.example.redis.RedisApplication: Post-processing of merged bean definition failed; nested exception is java.lang.NoClassDefFoundError: com/lambdaworks/redis/api/StatefulRedisConnection