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. error while loading shared libraries: libxml2.so.2: cannot open shared object file 解决方法

    参考: https://blog.csdn.net/qq_39779233/article/details/128215517 ==================================== ...

  2. 【LCA 树上两点的距离 判定点是否在某条边中】洛谷P3398 仓鼠找sugar

    题目链接:P3398 仓鼠找 sugar - 洛谷 | (luogu.com.cn) 题目大意:判定一棵树上的两条边是否相交 Tag: [LCA] [树上两点间距离的计算] [如何判断与点在某条路径上 ...

  3. springcloud集成grpc(一)

    码云地址:https://gitee.com/lpxs/lp-springcloud.git 有问题可以多沟通:136358344@qq.com. GRPC简介 是谷歌开源的一个高性能的.通用的RPC ...

  4. 如何诱导AI犯罪-提示词注入

    我们用到的大模型基本把政治类信息.犯罪相关信息都已屏蔽.但是,黑客依旧可以使用提示词诱导和提示词注入的方式对大模型进行攻击. 1.提示词诱导 如果直接让AI提供犯罪过程,AI会直接拒绝.虽然AI对于大 ...

  5. portainer安装&升级

    2024年4月15日 关于升级: 如果需要升级 Portainer,请按以下步骤操作: 使用以下命令列出所有镜像: docker ps -a 根据需要删除指定镜像: docker rm <镜像名 ...

  6. thymeleaf学习问题整理

    使用配置 <properties> <java.version>1.8</java.version> <thymeleaf.version>3.0.9. ...

  7. Ubuntu Server 部署 FRP 反向代理

    踩坑记录 我使用的配置文件是官方提供的示例配置文件 通过 SSH 访问内网机器,应该没有问题. 第一次我使用 Docker 镜像 snowdreamtech/frps 在服务器上部署 frps,发现始 ...

  8. Java Swing Loading转圈的进度提示框

    Java Swing Loading转圈的进度提示框 具体只需要两个类 AnimatedPanel.java InfiniteProgressPanel.java 前因:我们开发的web应用,有个奇葩 ...

  9. 消息队列的对比测试与RocketMQ使用扩展

    消息队列的对比测试与RocketMQ使用扩展     本文的主要内容包括以下几个方面: 原有的消息技术选型 RocketMQ与kafka 测试对比 如何构建自己的消息队列服务 RocketMQ扩展改造 ...

  10. JavaScript习题之算法设计题

    // 1.九九乘法表 for (var i = 1; i < 10; i++) { document.write("<span>"); for (var j = ...