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 ...
随机推荐
- Win11、Win10局域网共享文件报错:共享文件夹出现,您的账号已锁定,无法访问
解决方法,见: https://blog.csdn.net/dengww_/article/details/133887598 解决方法: https://blog.csdn.net/dengww_/ ...
- 蒸馏网络中的bias是指什么? —— 论文《Distilling the Knowledge in a Neural Network》—— 知识蒸馏
论文地址: https://arxiv.org/pdf/1503.02531.pdf 在蒸馏网络中会遇到手动调整bias的说法,但是这个bias在论文中又没有明细说明是怎么个bias,具体论文出处: ...
- 对于围棋AI作弊的一些思考
最近看到些关于围棋AI作弊的报道有了一些思考. 相关视频链接: https://www.bilibili.com/video/BV1np411f73b/?spm_id_from=autoNext ht ...
- 【转载】 机器人真·涨姿势了:比肩人类抓取能力,上海交大、非夕科技联合提出全新方法AnyGrasp
原文地址: https://developer.aliyun.com/article/822654 ================================================= ...
- 8月5日CSP-S模拟赛赛后总结
8月5日CSP-S模拟赛赛后总结 \[8月5日 \ \ CSP-S模拟赛 \ \ 赛后总结 \\ 2024年8月5日 \\ by \ \ \ uhw177po \] 一.做题情况 第一题比赛 \(10 ...
- 13. Advanced-control timers (TIM1 and TIM8)
1. 基本介绍 有三个基础的寄存器: 计数寄存器(TIMx_CNT,Counter register) 预分频寄存器(TIMx_PSC,Prescaler register) 自动重载寄存器(TIMx ...
- k8s pvc扩容
#查看是否支持扩容 $ kubectl get sc ** -o yaml ··· allowVolumeExpansion: true #拥有该字段表示允许动态扩容 ··· #找到需要扩容的pvc ...
- k8s中文文档
地址:http://docs.kubernetes.org.cn/122.html
- three.js实现太阳系
前言 刚开始使用three.js时会不太熟悉,想写一些项目增加理解,网上翻了好多文章,不是画立方体就是画三角形,最后偶然看到这个网站,十分炫酷. 我们也许没那么牛逼,但我们可以整个简略版的太阳系来练练 ...
- seata 下载及安装
分布式事务 参考文章: 分布式事务实战方案汇总 https://www.cnblogs.com/yizhiamumu/p/16625677.html 分布式事务原理及解决方案案例https://www ...