当前位置: 首页 > news >正文

音乐网站用dw怎么做微信app下载安装2024最新版

音乐网站用dw怎么做,微信app下载安装2024最新版,html网页制作参考文献,建设高端网站公司的目的微服务远程调用之拦截器实战 前言#xff1a; 在我们开发过程中#xff0c;很可能是项目是从0到1开发#xff0c;或者在原有基础上做二次开发#xff0c;这次是根据已有代码做二次开发#xff0c;需要在我们微服务一【这里方便举例#xff0c;我们后面叫模版微服务】调用…微服务远程调用之拦截器实战 前言 在我们开发过程中很可能是项目是从0到1开发或者在原有基础上做二次开发这次是根据已有代码做二次开发需要在我们微服务一【这里方便举例我们后面叫模版微服务】调用微服务二【后面叫系统管理模块】 需求背景 1模版服务需要给当前系统所有用户做默认的模版数据 2用户数据在系统管理模块里面 3需要将没有默认模板的用户的人查找出来添加默认模板数据。 4一般服务与服务之间调用要有请求头信息比如tokenuser_id …【遇到问题里面细讲】 使用步骤 1、引入openfeign依赖 dependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-openfeign/artifactId /dependency2、Feignclient远程接口 package com.xx.xx.xx.feign.client;import com.xx.xx.xx.api.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.HttpHeaders; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam;/*** author psd * xxx_manage_service 远程调用微服务的名字* 请求地址是全路径地址**/ FeignClient(name xxx_manage_service) public interface SmartGateWayClient {GetMapping(/api/xx/portalMyConfig/queryAllPortalMyConfig)RListMyxxxConfigVo queryAllMyxxxConfigVo();} 3、编写feignClient拦截器 每次远程调用前设置请求头信息 package com.xx.xx.xx.interceptor;import feign.RequestInterceptor; import feign.RequestTemplate; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component;import javax.servlet.http.HttpServletRequest;/*** author psd 远程调用拦截器设置头参数信息*/ Slf4j Component public class FeignClientInterceptor implements RequestInterceptor {HttpServletRequest request;public FeignClientInterceptor(HttpServletRequest request) {this.request request;}Overridepublic void apply(RequestTemplate requestTemplate) {// 设置请求头的数据requestTemplate.header(Authorization,request.getHeader(Authorization));// TODO:有的还需要添加 user_id 信息 log.info(FeignClientInterceptor 拦截器中的请求头的信息 Authorization :{},request.getHeader(Authorization));} }4、主启动类添加EnableFeignClients 注解 package com.xx.xxx.platform;import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.scheduling.annotation.EnableScheduling; import springfox.documentation.swagger2.annotations.EnableSwagger2;/*** author psd*/RefreshScope EnableSwagger2 EnableScheduling EnableFeignClients EnableDiscoveryClient MapperScan(xx.xx.xx.xx.mapper) SpringBootApplication public class PortalPlatformApplication {public static void main(String[] args) {SpringApplication.run(PlatformApplication.class, args);} } 遇到的问题 1、使用Feignclient 是从网关还是直接走指定微服务 网关现在理解就是所有的请求都走网关就是负载均衡路由转发作用… 看项目需求一般走指定微服务 2、编写Feignclient拦截器时候有时需要添加user_id 信息在系统管理服务里面有拦截这个不一定具体业务具体分析 3、有个远程调用返回MyxxxConfigVo 里面有个时间 /*** 创建时间*/private LocalDateTime createTime;/*** 修改时间*/private LocalDateTime updateTime;在项目接收方也是这个数据类型报以下异常 Caused by: org.springframework.web.client.RestClientException: Error while extracting response for type [com.pubinfo.smart.common.web.Rjava.util.Listcom.xx.xx.xx.feign.vo.MyxxxConfigVo ] and content type [application/json;charsetUTF-8]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type java.time.LocalDateTime from String “2024-05-25T16:25:02”: Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text ‘2024-05-25T16:25:02’ could not be parsed at index 10; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type java.time.LocalDateTime from String “2024-05-25T16:25:02”: Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text ‘2024-05-25T16:25:02’ could not be pars 大概意思是返回JSON String “2024-05-25T16:25:02”: 不能转换为 LocalDateTime 类型的时间。 修改为以下问题解决。 /*** 创建时间*/JsonFormat(pattern yyyy-MM-ddTHH:mm:ss)private LocalDateTime createTime;/*** 修改时间*/JsonFormat(pattern yyyy-MM-ddTHH:mm:ss)private LocalDateTime updateTime;4、自定义模版服务调用系统管理服务 在请求的时候报 用户不存在 详细描述 但是添加了token的信息且token不为空这个后面猜测可能是在系统管理服务里面有个拦截器需要校验user_id 是否为空为空就报异常。 后面在远程调用前添加 请求头信息user_id 的值。问题解决 喜欢我的文章的话点个阅读或者点个点赞是我编写博客的动力持续更新中 ing…
http://www.dnsts.com.cn/news/6131.html

相关文章:

  • 做足球行业深度内容的网站做网站生意不赚钱
  • 企业网站开发设计网站建设承诺
  • 小米路由器3做网站wordpress区块链插件
  • 天津工程建设信息网站博客可以放自己做的网站
  • 我想建网站做网站相册
  • 1个人做几个网站的负责人网站建设如何上传文件
  • 南京做网站建设有哪些内容备案查询化妆品
  • 20m带宽做网站够用吗wordpress 漂浮窗口
  • 中国免费图片素材网站网页设计中常见的布局有哪些
  • 学生网站模板做网站挂广告 刷广告
  • 理财p2p网站开发网站推广应该坚持什么策略
  • 惠州 网站建设厦门百度网站建设
  • 公司网站改版需要怎么做用新域名做网站排名快吗
  • php做手机网站不同性质网站
  • 东莞网站推广优化搜索推广网站seo在线诊断
  • 哪个网站可以做优惠券建设项目环保备案登记网站
  • 大鹏网络网站建设网站h1
  • 蛋糕网站模版深圳外贸公司网站建设公司排名
  • 邵阳汽车网站建设网站外链带nofollow是什么意思
  • 微信公众号可以做网站嘛学生做微商怎么加入
  • 三网合一网站建设报价cdn wordpress 回复
  • 嘉定南翔网站建设网页代码编辑器有哪些软件
  • 网站上线后做什么网站怎么申请微信支付接口
  • dede网站架设教程如何做酒网站
  • 网站做目录网站建设 网站开发
  • 网站自响应深圳有哪些网站公司
  • 亳州企业网站建设佛山外贸网站建设信息
  • 广州做网站(信科网络)天津网站建设的公司
  • 网站中的文字滑动怎么做怎能建设个人网站
  • 企业年金怎么查询海口百度seo