Skip to content

Commit ba22da8

Browse files
authored
fix: Adapt JAXBRuntimeHints to the behavior change in Spring 6.0.13 (#984)
## Motivation Since Spring 6.0.13 and the fix for spring-projects/spring-framework#31224, the member category `INVOKE_DECLARED_METHODS` no longer includes public methods so the code needs to be adapted to this behavior change. ## Modifications: * Register also the member category `INVOKE_PUBLIC_METHODS` when `INVOKE_DECLARED_METHODS` is registered
1 parent 9285f06 commit ba22da8

File tree

2 files changed

+7
-5
lines changed
  • components-starter/camel-xml-jaxb-starter/src

2 files changed

+7
-5
lines changed

components-starter/camel-xml-jaxb-starter/src/main/java/org/apache/camel/xml/jaxb/springboot/JAXBRuntimeHints.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,11 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
196196
}
197197
applyIfMatch(c, XmlJavaTypeAdapter.class, XmlJavaTypeAdapter::value,
198198
type -> hints.reflection().registerType(type, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS,
199-
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS));
199+
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_PUBLIC_METHODS,
200+
MemberCategory.DECLARED_FIELDS));
200201
hints.reflection().registerType(c, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS,
201-
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS);
202+
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_PUBLIC_METHODS,
203+
MemberCategory.DECLARED_FIELDS);
202204
}
203205
boolean classDetected = false;
204206
for (String className : getClassesFromIndexes(classLoader)) {
@@ -217,15 +219,16 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
217219
MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS);
218220
for (Class<?> c : JAXB_ANNOTATIONS) {
219221
hints.reflection().registerType(c, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS,
220-
MemberCategory.INVOKE_DECLARED_METHODS);
222+
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_PUBLIC_METHODS);
221223
}
222224
hints.proxies().registerJdkProxy(TypeReference.of(XmlSeeAlso.class), TypeReference.of("org.glassfish.jaxb.core.v2.model.annotation.Locatable"));
223225
for (String className : NATIVE_PROXY_DEFINITIONS) {
224226
hints.proxies().registerJdkProxy(TypeReference.of(className));
225227
}
226228
for (String className : JAXB_RUNTIME_CLASSES) {
227229
hints.reflection().registerTypeIfPresent(classLoader, className,
228-
MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS);
230+
MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS,
231+
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_PUBLIC_METHODS);
229232
}
230233
// Register the JAXB resource bundles
231234
hints.reflection().registerTypeIfPresent(classLoader, "jakarta.xml.bind.Messages");

components-starter/camel-xml-jaxb-starter/src/test/java/org/apache/camel/xml/jaxb/springboot/Book.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
package org.apache.camel.xml.jaxb.springboot;
1818

19-
import jakarta.xml.bind.annotation.XmlAttribute;
2019
import jakarta.xml.bind.annotation.XmlElement;
2120
import jakarta.xml.bind.annotation.XmlRootElement;
2221
import jakarta.xml.bind.annotation.XmlTransient;

0 commit comments

Comments
 (0)