使用 spring-security-oauth2-autoconfigure:但需要 spring-security-oauth2.2.3.2.RELEASE

Using spring-security-oauth2-autoconfigure: but need spring-security-oauth2.2.3.2.RELEASE

我正在将我的项目从 Spring Boot 1.5.8 更新到 Spring Boot 2.0.x。作为该练习的一部分,我在尝试登录时 运行 遇到以下异常(使用 Redis 缓存 oauth2 令牌)。

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.springframework.data.redis.connection.RedisConnection.set([B[B)V -

我一直在查看以下相互关联的 github 问题集 解决这个问题:

https://github.com/spring-projects/spring-security-oauth/issues/1230 https://github.com/spring-projects/spring-security-oauth/issues/1335

...以及他们周围的各种 PR。

最重要的是,这似乎已在 spring-security-oauth 2.3 版中修复。2.RELEASE。

我的问题是:

我不直接在 pom.xml 中使用 spring-security-oauth。相反,我们使用 spring-security-oauth2-autoconfigure,我相信它会拖入 spring-security-oauth2.2.2.1.RELEASE(根据我的依赖列表,见下​​文)。

有什么好的方法可以引入固定的 spring-security-oauth 版本吗?或者有人知道这是否会很快被引入 spring-security-oauth2-autoconfigure 吗?

好的,我在 pom.xml 中解决了这个问题,如下所示

    <dependency>
        <groupId>org.springframework.security.oauth</groupId>
        <artifactId>spring-security-oauth2</artifactId>
        <version>2.3.2.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security.oauth.boot</groupId>
        <artifactId>spring-security-oauth2-autoconfigure</artifactId>
        <version>2.0.1.RELEASE</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.security.oauth</groupId>
                <artifactId>spring-security-oauth2</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

我的第二个问题是:是否有计划将 2.3.2.RELEASE spring-security-oauth 移至 spring-security-oauth2-autoconfigure 最终?