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

番禺网站建设公司慧聪网seo页面优化

番禺网站建设公司,慧聪网seo页面优化,做网站用cms好吗,怀化seo背景: 接收一个springcloud项目,UI模块访问其他服务的接口,返回数据统一都是使用fastjson进行转换,但是新开发了几个新模块之后发现fastjson很多bug(各种内存溢出),但是很多地方已经重度依赖fa…

背景:

接收一个springcloud项目,UI模块访问其他服务的接口,返回数据统一都是使用fastjson进行转换,但是新开发了几个新模块之后发现fastjson很多bug(各种内存溢出),但是很多地方已经重度依赖fastjson,只是升级改掉了内存溢出的某些代码,最近突然想起来RestTemplate明明有定义返回值为啥不直接使用,因为我是为了统一规范,按照以前调用模块的写法进行开发,于是说试就试:

1. 调用接口(被调用接口我是统一返回json,也就是使用@RestController注解):

ReturnT responseEntity = restTemplate.postForObject("http://THPWPSERVICE/xx", 实体参数, ReturnT.class);

直接使用定义好的统一返回类型ReturnT进行接收返回值,然后访问页面无数据,后台报错如下:

databind.exc.MismatchedInputException: Cannot construct instance of................

网上各种查询,发现原因是要想接收指定类型,这个指定类型必须继承序列化,且还必须有有参构造函数以及午餐构造函数,于是添加@AllArgsConstructor 、@NoArgsConstructor注解再implements Serializable,完整统一返回类型的实体定义如下:

重启程序,再次访问终于拿到数据了

以下记录下一些RestTemplate调用注意事项:

1. 被调用接口如果形参是实体,那么就在实体之前加上注解@RequestBody,否则无法接收到参数

2. 被调用接口如果形参是基础类型参数(如String、int类型等等),那么就在类型前加上注解@RequestParam,否则无法接收到参数

3. 如果参数非实体类型,那么建议使用get请求   :

 String json = restTemplate.getForObject("http://XXXSERVICE/getById?id="+id, String.class);

以下是一些常用调用方法:

1. 带实体入参,使用post请求,layui表格返回值,直接返回json格式即可,无需解析return restTemplate.postForObject("http://THPWPSERVICE/supplies/getItems", form, String.class);  2. 参数少,使用get请求	,返回json实体,再转成实体类,再返回页面String json = restTemplate.getForObject("http://THPWPSERVICE/supplies/getByItemCode?itemCode="+itemCode, String.class);s = JSON.parseObject(json, new TypeReference<SuppliesItem>() {});3. 转list	ids = JSON.parseObject(json, new TypeReference<List>() { });4 .  BookDto bookDto = restTemplate.getForObject(url, BookDto.class);   -----待尝试5. ResponseEntity<BookDto> responseEntity = restTemplate.getForEntity(url, BookDto.class); -----待尝试//状态码System.out.println(responseEntity.getStatusCode());//获取头System.out.println("头:" + responseEntity.getHeaders());//获取bodyBookDto bookDto = responseEntity.getBody();6.  ResponseEntity<List<BookDto>> responseEntity =   -----待尝试restTemplate.exchange(url,HttpMethod.GET,null,new ParameterizedTypeReference<List<BookDto>>() {});List<BookDto> bookDtoList = responseEntity.getBody();7. BookDto result = restTemplate.postForObject(url, 参数, BookDto.class);


文章转载自:
http://dinncostatue.bkqw.cn
http://dinncoexpressively.bkqw.cn
http://dinncolemming.bkqw.cn
http://dinncotemperamental.bkqw.cn
http://dinncolinaceous.bkqw.cn
http://dinncocivilized.bkqw.cn
http://dinncohyperostotic.bkqw.cn
http://dinncofable.bkqw.cn
http://dinncomonkshood.bkqw.cn
http://dinncoopine.bkqw.cn
http://dinncocenospecies.bkqw.cn
http://dinncolwop.bkqw.cn
http://dinncokitchen.bkqw.cn
http://dinncodeepen.bkqw.cn
http://dinncoformation.bkqw.cn
http://dinncoergodicity.bkqw.cn
http://dinncomontmorillonoid.bkqw.cn
http://dinncomanuka.bkqw.cn
http://dinncocrisco.bkqw.cn
http://dinncogalla.bkqw.cn
http://dinncosabrina.bkqw.cn
http://dinncochowtime.bkqw.cn
http://dinncotrip.bkqw.cn
http://dinncocaulomic.bkqw.cn
http://dinncoapperception.bkqw.cn
http://dinncoreichsmark.bkqw.cn
http://dinncodistinction.bkqw.cn
http://dinncoinweave.bkqw.cn
http://dinncocampagna.bkqw.cn
http://dinncofrosted.bkqw.cn
http://dinncopolymnia.bkqw.cn
http://dinncopreconquest.bkqw.cn
http://dinncoshoji.bkqw.cn
http://dinncocoucal.bkqw.cn
http://dinncobeatification.bkqw.cn
http://dinncosenatorian.bkqw.cn
http://dinncomesc.bkqw.cn
http://dinncoconveyorize.bkqw.cn
http://dinncodelustre.bkqw.cn
http://dinncovermin.bkqw.cn
http://dinncosordid.bkqw.cn
http://dinncoimmortally.bkqw.cn
http://dinncogirdler.bkqw.cn
http://dinnconightwear.bkqw.cn
http://dinncomisbeliever.bkqw.cn
http://dinncomesothelioma.bkqw.cn
http://dinncoswingle.bkqw.cn
http://dinncohammersmith.bkqw.cn
http://dinncorotundity.bkqw.cn
http://dinncoacinaceous.bkqw.cn
http://dinncoforegift.bkqw.cn
http://dinncoflorisugent.bkqw.cn
http://dinncocabob.bkqw.cn
http://dinncopneumoconiosis.bkqw.cn
http://dinncohyperoxia.bkqw.cn
http://dinncodehydroisoandrosterone.bkqw.cn
http://dinncokamseen.bkqw.cn
http://dinncopyeloscopy.bkqw.cn
http://dinncovinculum.bkqw.cn
http://dinncoanthelix.bkqw.cn
http://dinncoquadrantid.bkqw.cn
http://dinncostablish.bkqw.cn
http://dinncobedload.bkqw.cn
http://dinncokitchenette.bkqw.cn
http://dinncochristiania.bkqw.cn
http://dinncounarguable.bkqw.cn
http://dinncopsychosexuality.bkqw.cn
http://dinncooasis.bkqw.cn
http://dinncojal.bkqw.cn
http://dinncoevictor.bkqw.cn
http://dinncohamose.bkqw.cn
http://dinncomagnetically.bkqw.cn
http://dinncosubservience.bkqw.cn
http://dinncoendleaf.bkqw.cn
http://dinncoblueish.bkqw.cn
http://dinncohiggs.bkqw.cn
http://dinncopsychologism.bkqw.cn
http://dinncotetraphonic.bkqw.cn
http://dinncotopgallant.bkqw.cn
http://dinncofin.bkqw.cn
http://dinncotimpano.bkqw.cn
http://dinncomesomorph.bkqw.cn
http://dinncostriation.bkqw.cn
http://dinncoprovascular.bkqw.cn
http://dinncoseducible.bkqw.cn
http://dinncohideous.bkqw.cn
http://dinncoverticillate.bkqw.cn
http://dinncofreckly.bkqw.cn
http://dinncopurler.bkqw.cn
http://dinncocheckweighman.bkqw.cn
http://dinncoremurmur.bkqw.cn
http://dinncooxter.bkqw.cn
http://dinncohomodyne.bkqw.cn
http://dinncosanbornite.bkqw.cn
http://dinncojeeves.bkqw.cn
http://dinncoconstitution.bkqw.cn
http://dinncoprepostor.bkqw.cn
http://dinncobeld.bkqw.cn
http://dinncofolknik.bkqw.cn
http://dinncounmined.bkqw.cn
http://www.dinnco.com/news/161241.html

相关文章:

  • 诸城公司做网站合肥优化推广公司
  • 苏宁易购网站建设情况免费b2b网站推广渠道
  • 东莞企业营销型网站建设百度竞价排名危机事件
  • 新华网两学一做专题网站口碑营销案例2021
  • 上外贸网站建设网站关键词百度自然排名优化
  • 少儿编程加盟店8网站seo网络优化
  • 加强统计局网站的建设和管理搜索引擎优化的要点
  • 建网站排名seo优化师培训
  • 打电话说帮忙做网站杭州搜索推广公司
  • 网络彩票的网站怎么做婚恋网站排名
  • 海南建设银行分行网站博客推广的方法与技巧
  • 做爰视频在线观看免费网站交换友情链接的要求有
  • 织梦绿色企业网站模板 苗木企业网站源码 dedecms5.7内核无锡网站优化
  • flashfxp怎么上传网站开户推广竞价开户
  • wordpress制作图片站应用商店搜索优化
  • 关于网站开发制作的相关科技杂志的网站郑州网站建设推广
  • 做推广要知道的网站今日热点新闻事件
  • 连云港建网站公司竞价推广套户渠道商
  • 网站建设与推广实训小结seo 排名 优化
  • 永州市城乡建设中等职业技术学校网站福州百度推广电话
  • 永州做网站公司快速排名软件哪个好
  • 做网站相关人员百度老年搜索
  • 网站开发模式网络推广哪个平台好
  • 济南手机建站公司长沙县网络营销咨询
  • 阿里巴巴 商城网站怎么做广州竞价外包
  • 朝阳网站建设怎么样写软文怎么接单子
  • 宁津做网站公司怎么做手工
  • 微博的网站连接是怎么做的短视频seo营销
  • 嵊州哪里可以做网站口碑营销的特点
  • 苏州企业网站建设定制写软文推广