NoSuchMethodError: org.springframework.data.redis.connection.RedisConnection.set([B[B)V异常处理办法

NoSuchMethodError: org.springframework.data.redis.connection.RedisConnection.set([B[B)V异常处理办法

一. 异常描述

在将我的Spring boot项目版本升到2.0.3,集成了Spring Security OAuth2(默认版本),redis(默认版本),并且用redis来存储token,项目正常启动后,请求token时报错:

nested exception is java.lang.NoSuchMethodError: org.springframework.data.redis.connection.RedisConnection.set([B[B)V

这个错误是因为版本问题,Spring-data-redis 2.0版本中set(String,String)方法被弃用了.

二. 解决办法

在spring-cloud-starter-security中排除默认的spring-security-oauth2依赖,然后添加2.3.3.RELEASE新版本的spring-security-oauth2依赖.


   
      org.springframework.cloud
      spring-cloud-starter-security
      
         
         
            spring-security-oauth2
org.springframework.security.oauth
         
      
    

    
       org.springframework.security.oauth
       spring-security-oauth2
       2.3.3.RELEASE


 

你可能感兴趣的:(SpringCloud,SpringSecurity)