Skip to content

GH-10058: Add SpEL JSON accessors and converter with Jackson 3 #10203

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

anthologia
Copy link
Contributor

@anthologia anthologia commented Jul 14, 2025

Related to: #10058

  • Add JsonNodePropertyAccessor for reading JSON object properties
  • Add JsonArrayNodeIndexAccessor for array index access
  • Add JsonNodeWrapperConverter for type conversion between JsonNodeWrapper and JsonNode
  • Add EmbeddedJsonMessageHeadersMessageMapper for JSON message serialization with embedded headers
  • Deprecate Jackson 2 SpEL JSON accessors

I've prepared changes to deprecate other Jackson 2 classes and make 3 as the project default, but this involves several changes and discussion points. (I encountered an NPE in Jackson 3 logic that maybe needs to be fixed by the Jackson team, but I've implemented a workaround in our code.)

For this reason, I've kept it separate from the current Accessor PR and will address it in the upcoming PR.

…ackson 3

Related to: spring-projects#10058

* Add `JsonNodePropertyAccessor` for reading JSON object properties
* Add `JsonArrayNodeIndexAccessor` for array index access
* Add `JsonNodeWrapperConverter` for type conversion between `JsonNodeWrapper` and `JsonNode`
* Add `EmbeddedJsonMessageHeadersMessageMapper` for JSON message serialization with embedded headers
* Deprecate Jackson 2 SpEL JSON accessors

Signed-off-by: Jooyoung Pyoung <[email protected]>
* @since 7.0
* @see JsonNodePropertyAccessor
*/
public class JsonArrayNodeIndexAccessor implements IndexAccessor {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it (and all new classes) as JacksonIndexAccessor!
That would be much easier for end-users to migrate.
And I anticipate a renaming back to Json when we remove those deprecated classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a question about backward compatibility regarding the naming strategy.

If we rename JacksonIndexAccessor back to JsonIndexAccessor in the future (after removing deprecated classes), wouldn't this break backward compatibility for users who migrated to JacksonIndexAccessor ?

* Adopt more intuitive naming for Jackson 3 migration
* Remove deprecated classes tests

Signed-off-by: Jooyoung Pyoung <[email protected]>
* @author Jooyoung Pyoung
*
* @since 7.0
* @see JacksonPropertyAccessor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blank line after @since.
I like to see sections in class JavaDoc separated.

* @author Artem Bilan
* @author Paul Martin
* @author Pierre Lakreb
* @author Sam Brannen
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, bring back all the names.
The class re-naming is not justification of taking authorship away.

@@ -60,7 +60,7 @@
*
* @since 7.0
*/
class JacksonJsonObjectMapperTests {
public class JacksonJsonObjectMapperTests {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change, please?
JUnit Jupiter is good to work with non-public classes and methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants