Skip to content

Expose ClassLoader from DefaultDeserializer#36833

Closed
seonwooj0810 wants to merge 1 commit into
spring-projects:mainfrom
seonwooj0810:gh-36827-default-deserializer-classloader
Closed

Expose ClassLoader from DefaultDeserializer#36833
seonwooj0810 wants to merge 1 commit into
spring-projects:mainfrom
seonwooj0810:gh-36827-default-deserializer-classloader

Conversation

@seonwooj0810
Copy link
Copy Markdown

This commit adds a public getClassLoader() accessor on
DefaultDeserializer to expose the ClassLoader configured via the
constructor introduced in 4.2.1.

The motivation for this is described in gh-36827: Spring Integration's
AllowListDeserializingConverter currently reads the private
classLoader field via DirectFieldAccessor reflection in order to
forward it to a ConfigurableObjectInputStream subclass. Exposing a
proper getter avoids the reflection and removes the need for any
related native image hint.

The accessor mirrors the nullability of the underlying field. A pair of
unit tests in SerializerTests cover both the no-arg and explicit
ClassLoader constructors.

Closes gh-36827

Add a public accessor for the ClassLoader configured on a
DefaultDeserializer instance so that callers no longer need to
read the private field via reflection in order to forward it to a
ConfigurableObjectInputStream subclass.

Closes spring-projectsgh-36827

Signed-off-by: seonwoo_jung <laborlawseon@kap.kr>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 25, 2026
@sbrannen sbrannen added the in: core Issues in core modules (aop, beans, core, context, expression) label May 26, 2026
@sbrannen sbrannen self-assigned this May 26, 2026
@sbrannen sbrannen added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels May 26, 2026
@sbrannen sbrannen added this to the 7.1.0-M1 milestone May 26, 2026
@sbrannen sbrannen changed the title Expose ClassLoader from DefaultDeserializer Expose ClassLoader from DefaultDeserializer May 26, 2026
@artembilan
Copy link
Copy Markdown
Member

Hey, @sbrannen !

any chances this could be back-ported down to 6.2.x for upcoming releases in a week?

thanks

@sbrannen
Copy link
Copy Markdown
Member

any chances this could be back-ported down to 6.2.x for upcoming releases in a week?

@artembilan, I was literally going to ask you about that offline. 😉

Sure, I think it would be fine to backport this one, since it's only the introduction of an accessor method.

@sbrannen sbrannen modified the milestones: 7.1.0-M1, 7.0.8 May 26, 2026
@sbrannen sbrannen added the for: backport-to-6.2.x Marks an issue as a candidate for backport to 6.2.x label May 26, 2026
@sbrannen
Copy link
Copy Markdown
Member

Hi @seonwooj0810,

Congratulations on submitting your first PR for the Spring Framework! 👍

In the future, please do not submit a PR for an issue that still has the "status: waiting-for-triage" label.

Instead, please ask first on the original issue if the team is willing to accept a PR.

Thanks

sbrannen added a commit that referenced this pull request May 26, 2026
@sbrannen sbrannen closed this in f7be796 May 26, 2026
sbrannen pushed a commit that referenced this pull request May 26, 2026
Add a public accessor for the ClassLoader configured on a
DefaultDeserializer instance so that callers no longer need to read the
private field via reflection in order to forward it to a
ConfigurableObjectInputStream subclass.

See gh-36827
Closes gh-36833

Signed-off-by: seonwoo_jung <laborlawseon@kap.kr>
(cherry picked from commit f7be796)
sbrannen added a commit that referenced this pull request May 26, 2026
See gh-36833

(cherry picked from commit 6e122d3)
@github-actions github-actions Bot added the status: backported An issue that has been backported to maintenance branches label May 26, 2026
@sbrannen sbrannen removed the for: backport-to-6.2.x Marks an issue as a candidate for backport to 6.2.x label May 26, 2026
@sbrannen
Copy link
Copy Markdown
Member

This has been merged into 7.0.x and main in f7be796, slightly revised in 6e122d3, and backported to 6.2.x in de18f74.

Thanks

@seonwooj0810
Copy link
Copy Markdown
Author

Thank you for the review, the merge, and the backport to 6.2.x! I'll make sure to check the issue status and ask on the issue first before submitting a PR next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add DefaultDeserializer.getClassLoader()

4 participants