|
|
@ -20,12 +20,14 @@ import org.springframework.aot.hint.BindingReflectionHintsRegistrar; |
|
|
|
import org.springframework.aot.hint.RuntimeHints; |
|
|
|
import org.springframework.aot.hint.RuntimeHints; |
|
|
|
import org.springframework.aot.hint.RuntimeHintsRegistrar; |
|
|
|
import org.springframework.aot.hint.RuntimeHintsRegistrar; |
|
|
|
import org.springframework.http.ProblemDetail; |
|
|
|
import org.springframework.http.ProblemDetail; |
|
|
|
|
|
|
|
import org.springframework.util.ClassUtils; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* {@link RuntimeHintsRegistrar} implementation that registers binding reflection entries |
|
|
|
* {@link RuntimeHintsRegistrar} implementation that registers binding reflection entries |
|
|
|
* for {@link ProblemDetail} serialization support with Jackson. |
|
|
|
* for {@link ProblemDetail} serialization support with Jackson. |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Brian Clozel |
|
|
|
* @author Brian Clozel |
|
|
|
|
|
|
|
* @author Stephane Nicoll |
|
|
|
* @since 6.0.5 |
|
|
|
* @since 6.0.5 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class ProblemDetailRuntimeHints implements RuntimeHintsRegistrar { |
|
|
|
class ProblemDetailRuntimeHints implements RuntimeHintsRegistrar { |
|
|
@ -34,6 +36,12 @@ class ProblemDetailRuntimeHints implements RuntimeHintsRegistrar { |
|
|
|
public void registerHints(RuntimeHints hints, ClassLoader classLoader) { |
|
|
|
public void registerHints(RuntimeHints hints, ClassLoader classLoader) { |
|
|
|
BindingReflectionHintsRegistrar bindingRegistrar = new BindingReflectionHintsRegistrar(); |
|
|
|
BindingReflectionHintsRegistrar bindingRegistrar = new BindingReflectionHintsRegistrar(); |
|
|
|
bindingRegistrar.registerReflectionHints(hints.reflection(), ProblemDetail.class); |
|
|
|
bindingRegistrar.registerReflectionHints(hints.reflection(), ProblemDetail.class); |
|
|
|
|
|
|
|
if (ClassUtils.isPresent("com.fasterxml.jackson.dataformat.xml.XmlMapper", classLoader)) { |
|
|
|
|
|
|
|
bindingRegistrar.registerReflectionHints(hints.reflection(), ProblemDetailJacksonXmlMixin.class); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (ClassUtils.isPresent("com.fasterxml.jackson.annotation.JacksonAnnotation", classLoader)) { |
|
|
|
|
|
|
|
bindingRegistrar.registerReflectionHints(hints.reflection(), ProblemDetailJacksonMixin.class); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|