feign 服务间调用异常,feign.codec.DecodeException: Could not extract response: no suitable HttpMessageConver

2022-08-12 11:46:56

feign.codec.DecodeException: Could not extract response: no suitable HttpMessageConverter found for response type [] and content type [text/html;charset=UTF-8]

这是由于微服务添加spring-security-oauth2-autoconfigure导致调用微服务401unauthorised

 try {
            String token = SecurityUtil.getToken(httpServletRequest);
            Class<RedisTokenStore> redisTokenStoreClass = RedisTokenStore.class;
            redisTokenStoreClass.getDeclaredMethod("removeAccessToken", String.class).invoke(redisTokenStoreClass.newInstance(), token);
        } catch (Exception e) {
            e.printStackTrace();
        }

在项目中一个微服务的业务代码中加上以上会需要依赖一下依赖,但在微服务加入这个依赖会导致其他服务调用这个服务会出现401unauthorised未授权的情况,谨慎添加,至于关闭的方法还在研究中,或者用在业务使用rabbitmq队列进行异步解耦操作。
在微服务加入这个依赖会导致其他服务调用这个服务会出现未授权的情况,谨慎添加

  • 作者:yzhao666
  • 原文链接:https://blog.csdn.net/qq_43375661/article/details/124092545
    更新时间:2022-08-12 11:46:56