1.在整合springboot admin server时,发现admin client无法注册到admin server上

查找原因后发现代码中报错:HttpMediaTypeNotAcceptableException: Could not find acceptable representation

2.此时知道是返回给admin server类型时发生的错误,但是不知道admin server需要的是什么类型,所以重写WebMvcConfigurer

解析全部类型查看返回类型是什么

 @Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
for (HttpMessageConverter<?> converter : converters) {
if (converter instanceof MappingJackson2HttpMessageConverter) {
converters.remove(converter);
}
}
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
List<MediaType> supportedMediaTypes = new ArrayList<>();
//解析全部类型
supportedMediaTypes.add(MediaType.ALL); converter.setSupportedMediaTypes(supportedMediaTypes);
FastJsonConfig fastJsonConfig = new FastJsonConfig();
fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteDateUseDateFormat,
SerializerFeature.WriteNullStringAsEmpty,
SerializerFeature.WriteMapNullValue,
SerializerFeature.DisableCircularReferenceDetect);
//日期格式化
fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
converter.setFastJsonConfig(fastJsonConfig);
converters.add(converter);
}

3.调用接口,返回结果成功,得知需要的类型为:application/vnd.spring-boot.actuator.v2+json

4.添加对类型application/vnd.spring-boot.actuator.v2+json的解析

        //提供对admin的类型支持mediaType
MediaType mediaType = MediaType.valueOf("application/vnd.spring-boot.actuator.v2+json");
supportedMediaTypes.add(mediaType);

spring boot 与spring boot admin整合问题处理的更多相关文章

  1. Spring Boot + MyBatis + Druid + Redis + Thymeleaf 整合小结

    Spring Boot + MyBatis + Druid + Redis + Thymeleaf 整合小结 这两天闲着没事想利用**Spring Boot**加上阿里的开源数据连接池**Druid* ...

  2. Spring Boot与Spring Security整合后post数据不了,403拒绝访问

    http://blog.csdn.net/sinat_28454173/article/details/52251004 *************************************** ...

  3. [权限管理系统(四)]-spring boot +spring security短信认证+redis整合

    [权限管理系统]spring boot +spring security短信认证+redis整合   现在主流的登录方式主要有 3 种:账号密码登录.短信验证码登录和第三方授权登录,前面一节Sprin ...

  4. Spring Boot,Spring Cloud,Eureka,Actuator,Spring Boot Admin,Stream,Hystrix

    Spring Boot,Spring Cloud,Eureka,Actuator,Spring Boot Admin,Stream,Hystrix 一.Spring Cloud 之 Eureka. 1 ...

  5. Spring Kafka和Spring Boot整合实现消息发送与消费简单案例

    本文主要分享下Spring Boot和Spring Kafka如何配置整合,实现发送和接收来自Spring Kafka的消息. 先前我已经分享了Kafka的基本介绍与集群环境搭建方法.关于Kafka的 ...

  6. Spring Boot(Spring的自动整合框架)

    Spring Boot 是一套基于Spring框架的微服务框架,由于Spring是一个轻量级的企业开发框架,主要功能就是用于整合和管理其他框架,想法是将平时主流使用到的框架的整合配置预先写好,然后通过 ...

  7. 解决Spring Boot(2.1.3.RELEASE)整合spring-data-elasticsearch3.1.5.RELEASE报NoNodeAvailableException[None of the configured nodes are available

    Spring Boot(2.1.3.RELEASE)整合spring-data-elasticsearch3.1.5.RELEASE报NoNodeAvailableException[None of ...

  8. Spring boot 整合spring Data JPA+Spring Security+Thymeleaf框架(上)

    近期上班太忙所以耽搁了给大家分享实战springboot 框架的使用. 以下是spring boot 整合多个框架的使用. 首先是准备工作要做好. 第一  导入框架所需的包,我们用的事maven 进行 ...

  9. Spring 5.x 、Spring Boot 2.x 、Spring Cloud 与常用技术栈整合

    项目 GitHub 地址:https://github.com/heibaiying/spring-samples-for-all 版本说明: Spring: 5.1.3.RELEASE Spring ...

  10. Spring Boot 2.0 快速集成整合消息中间件 Kafka

    欢迎关注个人微信公众号: 小哈学Java, 每日推送 Java 领域干货文章,关注即免费无套路附送 100G 海量学习.面试资源哟!! 个人网站: https://www.exception.site ...

随机推荐

  1. 【Mybatis】记录下一些问题

    报错信息: 找不到映射的结果Map 其实这里的包的名字和资源的名字都是正确的 但是啊,但是啊,在Mapper.xml上面的命名空间的声明上换行了,这就能导致Mybatis找不到这个资源: 我和同事看了 ...

  2. 如果美国断供中国所有的Intel和AMD芯片,国内各行各业会不会崩溃

    说一个我个人观点,我认为如果国内完全没有X86芯片的供应,那么各行各业的发展会明显进入发展迟缓阶段,首先受影响的就是软件开发领域,因为没有新的芯片也就意味着袋电脑性能停滞或者倒退,那么开发出新的更耗资 ...

  3. 美国小伙: "American Guy: Only communism can save America!"

    视频地址: https://www.youtube.com/watch?v=Y_WQnXFh8ss 2024大选在即,又是拜登对阵特朗普的旧日重现.在角逐谁的对手反对者更多的畸形内耗中,有一个名为 M ...

  4. 强化学习baseline论文—— rainbow算法中给出实验结果的54个atari2600游戏名称列表

    alien amidar assault asterix asteroids atlantis bank_heist battle_zone beam_rider berzerk bowling bo ...

  5. Python 环境傻瓜式搭建 :Anaconda概述

    Anaconda概述 Anaconda是一个用于科学计算的Python发行版,支持 Linux, Mac, Windows系统,提供了包管理与环境管理的功能,可以很方便地解决多版本python并存.切 ...

  6. 遥遥领先!鲲鹏ARM架构下国产数据同步能力大幅提升16.9倍

    在上篇文章<2.6倍!WhaleTunnel客户POC实景对弈DataX>发布之后,一个客户突然向我们控诉其苦DataX久矣,因为是在信创的鲲鹏ARM CPU上运行 ,每天同步需要很长时间 ...

  7. 告别Hugging Face模型下载难题:掌握高效下载策略,畅享无缝开发体验

    告别Hugging Face模型下载难题:掌握高效下载策略,畅享无缝开发体验 Huggingface国内开源镜像:https://hf-mirror.com/ 里面总结了很多下载的方法,下面进行一一讲 ...

  8. Aspire8一文通

    Aspire8一文通 0.简介 微软Aspire是微软今年推出的一个全新的平台无关.语言无关的新框架,它的设计目的是简化云原生应用的开发.部署和管理过程.Aspire的读音是[əˈspaɪər],它的 ...

  9. Linux-mknod命令

    mknod 创建块设备或者字符设备文件.此命令的适用范围:RedHat.RHEL.Ubuntu.CentOS.SUSE.openSUSE.Fedora. 用法: mknod [选项]... 名称 类型 ...

  10. 技术如何通过API接口获取自己想要同款商品的数据

    确定数据源: 首先,你需要确定哪些平台或服务提供商提供了你感兴趣的商品数据.例如,电商平台.品牌商.市场调研公司等. 了解API文档: 访问提供商的开发者门户网站,阅读API文档.文档会详细介绍如何使 ...