-
Notifications
You must be signed in to change notification settings - Fork 40.6k
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
Spring Boot Actuator dependency on Jackson prevents usage of GSON #2247
Comments
I don't think that's what the release notes is saying. Are you trying to use GSON for everything or your own services only? |
Spring Boot 1.2 Release Notes:
I was investigating how to use GSON for my own services. Release notes where only documentation I was able to find about Spring Boot and GSON support. |
Looks like this one might be a little tricky to fix. The easiest solution for now might be for us to disable that endpoint if Jackson is missing or find some way to allow them to co-exist. |
My point was that the release notes are only about what Boot uses internally. You can still configure and use Gson if that's what you want to do. |
I guess we need a way to tell the autoconfigurers that even if they find Jackson and GSON, we prefer GSON. I think the user can always create converters and assign an order using |
Reopening to consider comments in commit d718a80 |
preferred-mapper has been renamed to preferred-json-mapper to make it clear that it only affects the JSON mapper and that the XML mapper that will be used (if any) is unaffected See gh-2247
Is there a way to use Gson only for specific classes - mainly (JsonElement, JsonObject, JsonArray) and for the rest use Jackson. JsonElement is not a plain pojo, hence jackson has trouble serialising it. Would be good if we can use both or if actuator can work with Gson. How should we go about it? |
@balajeetm This issue has been closed for a while. If you've got additional questions please ask on stackoverflow.com. Thanks! |
According to Spring Boot 1.2.0 release notes all Jackson libraries has to be excluded from the classpath to use GSON for creating JSON output. This is not possible in case application is using
spring-boot-starter-actuator
.Excluding
jackson-core
,jackson-databind
andjackson-annotations
fromspring-boot-starter-actuator
will result withBeanCreationException
:And the application is not able to start.
It turns out
spring-boot-starter-actuator
needs all three mentioned Jackson libraries to start properly. Once Jackson libraries are included in the classpath GSON is not used to produce JSON output any more.The text was updated successfully, but these errors were encountered: