如何在特定的 spring 引导版本中使用不同的 spring 模块(spring-data-redis)版本
How to use different spring module (spring-data-redis) version in specific spring boot version
我有一个 Spring boot
项目 - 它的父项目是 spring-boot-starter-parent:2.1.9.RELEASE
。我想将 spring-data-redis
与 2.2.0.RELEASE
版本一起使用(不是 spring-boot-starter-data-redis
,因为它不支持 redis-streams
)。我也使用 Lettuce
版本 io.lettuce:lettuce-core:5.2.0.RELEASE
.
我的pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.9.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
然而,当 运行 时,尽管应用程序没有编译错误,但我收到以下错误。
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.data.redis.repository.configuration.RedisRepositoryConfigurationExtension.createMappingConfigBeanDef(RedisRepositoryConfigurationExtension.java:168)
The following method did not exist:
org/springframework/data/repository/config/RepositoryConfigurationSource.getRequiredAttribute(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;
The method's class, org.springframework.data.repository.config.RepositoryConfigurationSource, is available from the following locations:
jar:file:/Users/user1/.m2/repository/org/springframework/data/spring-data-commons/2.1.11.RELEASE/spring-data-commons-2.1.11.RELEASE.jar!/org/springframework/data/repository/config/RepositoryConfigurationSource.class
It was loaded from the following location:
file:/Users/user1/.m2/repository/org/springframework/data/spring-data-commons/2.1.11.RELEASE/spring-data-commons-2.1.11.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.data.repository.config.RepositoryConfigurationSource
spring-data-redis
已解析为 2.1.11.release
版本。
根据 Dirk Deyne 的提示(谁删除了那些评论?),spring-data-redis
版本可以用这样的预期版本覆盖
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
由于这个(有问题的错误)特定版本而出现其他依赖性问题,在这种情况下也必须添加其他库版本
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
和
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-keyvalue</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
我有一个 Spring boot
项目 - 它的父项目是 spring-boot-starter-parent:2.1.9.RELEASE
。我想将 spring-data-redis
与 2.2.0.RELEASE
版本一起使用(不是 spring-boot-starter-data-redis
,因为它不支持 redis-streams
)。我也使用 Lettuce
版本 io.lettuce:lettuce-core:5.2.0.RELEASE
.
我的pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.9.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
然而,当 运行 时,尽管应用程序没有编译错误,但我收到以下错误。
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.data.redis.repository.configuration.RedisRepositoryConfigurationExtension.createMappingConfigBeanDef(RedisRepositoryConfigurationExtension.java:168)
The following method did not exist:
org/springframework/data/repository/config/RepositoryConfigurationSource.getRequiredAttribute(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;
The method's class, org.springframework.data.repository.config.RepositoryConfigurationSource, is available from the following locations:
jar:file:/Users/user1/.m2/repository/org/springframework/data/spring-data-commons/2.1.11.RELEASE/spring-data-commons-2.1.11.RELEASE.jar!/org/springframework/data/repository/config/RepositoryConfigurationSource.class
It was loaded from the following location:
file:/Users/user1/.m2/repository/org/springframework/data/spring-data-commons/2.1.11.RELEASE/spring-data-commons-2.1.11.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.data.repository.config.RepositoryConfigurationSource
spring-data-redis
已解析为 2.1.11.release
版本。
根据 Dirk Deyne 的提示(谁删除了那些评论?),spring-data-redis
版本可以用这样的预期版本覆盖
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
由于这个(有问题的错误)特定版本而出现其他依赖性问题,在这种情况下也必须添加其他库版本
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
和
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-keyvalue</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>