Skip to content

Conversation

@marschall
Copy link
Contributor

Add a Dependencies manifest entry with the value jdk.unsupported to
spring-core.

Objenesis repackaged in Spring Core needs access to sun.reflect.ReflectionFactory located in the jdk.unsupported module. WildFly by default restricts applications from accessing the jdk.unsupported module (WFCORE-4055). This leads to obscure exceptions like #21528. In our case the default constructor of a Spring Batch job scoped bean could not be found. This was confusing because the bean had an autowired non-default constructor. The problem and solution were not obvious to us.

To give Objenesis in spring-core access to the jdk.unsupported module users need to do either of the following:

As Spring Core uses a repackaged Objenesis we can instead add the Dependencies manifest header to spring-core itself making things "just work"(tm) for Spring users on WildFly.

Add a Dependencies manifest entry with the value jdk.unsupported to spring-core.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 2, 2020
@sbrannen sbrannen requested a review from jhoeller October 3, 2020 13:14
@sbrannen sbrannen added the in: core Issues in core modules (aop, beans, core, context, expression) label Oct 3, 2020
@marschall
Copy link
Contributor Author

This change maintains compatibility with JDK 8.

@jhoeller jhoeller self-assigned this Oct 5, 2020
@jhoeller jhoeller added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 5, 2020
@jhoeller jhoeller added this to the 5.3 RC2 milestone Oct 5, 2020
@jhoeller jhoeller merged commit cf61545 into spring-projects:master Oct 6, 2020
@wilkinsona
Copy link
Member

This change seems to break applications deployed to old versions of Wildfly. See spring-projects/spring-boot#24686 for details.

@sbrannen sbrannen changed the title Add Dependencies Manifest Entry to spring-core Give spring-core access to jdk.unsupported for Objenesis support on Wildfly Aug 1, 2023
@sbrannen sbrannen changed the title Give spring-core access to jdk.unsupported for Objenesis support on Wildfly Give spring-core access to jdk.unsupported for Objenesis support on WildFly Aug 1, 2023
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) type: enhancement A general enhancement

5 participants