-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ApplicationContext's ObjectMapper is not used by reactive stack within InstancesProxyController (servlet-app, not webflux) #3830
Comments
Hi @DmitryTen ok, so lets sort out some things
So the best solution would be to not modify the default ObjectMapper and provide a separate one for your own business services. Or update to Spring Boot 3, where they introduced a separate ObjectMapper for the actuator endpoints. There have been already many issues regarding that topic, see for example #751 and the issues referenced there. |
Thank you for your answer @erikpetzold ! So, as i understand in my case i need to reconfigure my client ObjectMapper (yes we modified default one, therefore this would be not that easy) OR switch to spring 3.x.x, since then actuator endpoints could be linked to separated (not default) ObjectMapper (also not easy change). Thank you |
As I said before, the SBA backend will just pass-through the data it received from the services. The ObjectMapper in SBA is not relevant for your problem. The actuator json is generated in your services. So you have to adjust that in your services. One solution would be to have 2 ObjectMappters in your services: the default one which would be used by actuators and an own used in your business functionality. This can also be done without explicitly talking about ObjectMappers, but instead using 2 MessageConverters being used by the web layer. The Converters are then bound to mime-types. See #751 (comment) on the issue I already mentioned. |
Okay, thanks a lot! Your advice helped, i've configured actuator's ObjectMapper in my client to be default. Finally it passed, and jackson not a problem anymore.
Fast googling of this issue shows, that |
this looks like reactive stack (webFlux)
|
I'm talking about SBA server, i've tried that config on SBA server, but no luck
|
i made some debug, and found that while my
below the stack it uses
which is by default uses
and not the value from |
@erikpetzold could you please check the above comment?
is it supposed to be so? Is there a way to cope with that? Only reflection? |
The LegacyEndpointConverter should only be relevant for Spring Boot 1 applications. With Spring Boot 2, the actuator has its own mime type. Probably you changed the response type to be application/json, which triggers the LegacyEndpointConverter. See #3368 You should keep the original actuator mime type. -> In general, do not change the actuator endpoints |
Spring Boot Admin Server information
2.7.16
2.7.17
Servlet-application. My config is Servlet-app, and i think this is the reason of my issue.
Client information
2.7.17
spring-cloud-starter-kubernetes-fabric8, self-registration, kubernetes
Servlet-application
Description
Well, i'm not sure whether this is a bug in spring-boot-admin, or i'm just a dumb. I've asked my question on SO: https://stackoverflow.com/questions/79180318/spring-boot-admin-how-to-configure-objectmapper-which-is-used-by-its-reactor-li , but no informative answers or views appeared yet. If i'm wrong coming here, take my apologises please.
So, i'm trying to setup spring-boot-admin into my kubernetes, i've started with https://github.com/codecentric/spring-boot-admin-runtime-playground, and it worked quite well: it sees my app, and i'm able to view 'Insights' page, 'Logging' page, while other don't work yet. Right now i'm struggling with 'JVM->Thread dump', and i ran into issues with jackson objectMapper.
The thing is that my client-services use the specific config:
therefore when i request '/actuator/threaddump' in spring-boot-admin, it fails (because spring-boot-admin requests my service, and it returns not valid json) with error below (the error is quite long, so i've shortened it):
At first glance it seems to be an easy issue: just find the objectMapper and configure ACCEPT_SINGLE_VALUE_AS_ARRAY=true. BUT I JUST CAN'T FIND IT I mean i can't find the one (seems spring-boot-admin have several ones), which responsible for deserializing of requests to other services.
What i tried:
So, as i understand the issue, it's the following: the spring-boot-admin class de.codecentric.boot.admin.server.web.servlet.InstancesProxyController uses reactive stack (Flux,Mono,etc) even for Servlet-application, which uses separated from other app objectMapper, which seems to be not that easy to reconfigure (if possible)
Am i doing something wrong?
configs i use,
pom.xml:
application.yml
The text was updated successfully, but these errors were encountered: