spring boot 与spring boot admin整合问题处理
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整合问题处理的更多相关文章
- Spring Boot + MyBatis + Druid + Redis + Thymeleaf 整合小结
Spring Boot + MyBatis + Druid + Redis + Thymeleaf 整合小结 这两天闲着没事想利用**Spring Boot**加上阿里的开源数据连接池**Druid* ...
- Spring Boot与Spring Security整合后post数据不了,403拒绝访问
http://blog.csdn.net/sinat_28454173/article/details/52251004 *************************************** ...
- [权限管理系统(四)]-spring boot +spring security短信认证+redis整合
[权限管理系统]spring boot +spring security短信认证+redis整合 现在主流的登录方式主要有 3 种:账号密码登录.短信验证码登录和第三方授权登录,前面一节Sprin ...
- 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 ...
- Spring Kafka和Spring Boot整合实现消息发送与消费简单案例
本文主要分享下Spring Boot和Spring Kafka如何配置整合,实现发送和接收来自Spring Kafka的消息. 先前我已经分享了Kafka的基本介绍与集群环境搭建方法.关于Kafka的 ...
- Spring Boot(Spring的自动整合框架)
Spring Boot 是一套基于Spring框架的微服务框架,由于Spring是一个轻量级的企业开发框架,主要功能就是用于整合和管理其他框架,想法是将平时主流使用到的框架的整合配置预先写好,然后通过 ...
- 解决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 ...
- Spring boot 整合spring Data JPA+Spring Security+Thymeleaf框架(上)
近期上班太忙所以耽搁了给大家分享实战springboot 框架的使用. 以下是spring boot 整合多个框架的使用. 首先是准备工作要做好. 第一 导入框架所需的包,我们用的事maven 进行 ...
- Spring 5.x 、Spring Boot 2.x 、Spring Cloud 与常用技术栈整合
项目 GitHub 地址:https://github.com/heibaiying/spring-samples-for-all 版本说明: Spring: 5.1.3.RELEASE Spring ...
- Spring Boot 2.0 快速集成整合消息中间件 Kafka
欢迎关注个人微信公众号: 小哈学Java, 每日推送 Java 领域干货文章,关注即免费无套路附送 100G 海量学习.面试资源哟!! 个人网站: https://www.exception.site ...
随机推荐
- 【Vue】接口模块化处理
在前端Vue项目中,接口会被统一放在一个目录中管理: 一个模块的所有接口放在一个JS文件中: 文件会导入封装好的请求方法,和动态绑定的接口地址 import request from '@/utils ...
- 【Java-GUI】08 Swing02 边框和选择器
边框案例: package cn.dzz.swing; import javax.swing.*; import javax.swing.border.*; import java.awt.*; pu ...
- 循环神经网络 —— LSTM 图片
- 【转载】 NLP如此钟情英语研究真的好吗?
转载自: https://mbd.baidu.com/newspage/data/landingsuper?context=%7B%22nid%22%3A%22news_965090611243366 ...
- vscode配置远程项目开发
0. vscode中安装remote development插件 (略) 1. 客户端进行配置 按键:ctrl+shift+p 在输入框中输入: Preferences: Open User Sett ...
- vue(element)中代码高亮插件全面对比
@ 目录 全面对比 从活跃方面来看 从功能方面来看 深入对比 1,ace 2,codemirror 3,monaco 4,结论 全面对比 从活跃方面来看 从功能方面来看 代码高亮是必须的,社区必须活跃 ...
- CF1992场题解
Only Pluses 算法:数学. 题意简述:有三个数,每次选择一个数 \(x\),使得 \(x\) 增加一,至多操作 \(5\) 次,最后求出这三个数的乘积最大值. 简单题,一眼秒了.考虑把这 \ ...
- Binance 如何使用 Quickwit 构建 100PB 日志服务(Quickwit 博客)
三年前,我们开源了 Quickwit,一个面向大规模数据集的分布式搜索引擎.我们的目标很宏大:创建一种全新的全文搜索引擎,其成本效率比 Elasticsearch 高十倍,配置和管理显著更简单,并且能 ...
- mysql8.0 主从架构模式【0到1架构系列】
前提条件 准备3,4,5台虚拟机 祼装mysql8.0 主从架构 常见两种模式"一主多从"和"级联复制"两种,基本都很简单,都是依赖binlog日志文件进行同步 ...
- 【CMake系列】02-第一个CMake项目
本节我们用CMake 构建我们的第一个helloword的项目,从更细的粒度上了解CMake在做什么,对编写CMakeLists.txt 进入初步引入 本专栏的实践代码全部放在 github 上,欢迎 ...