Browse Source

Add HttpMethod reflection hint to ObjectToObjectConverterRuntimeHints

This commit adds a reflection hint for HttpMethod#valueOf in order
to be able to support conversion required for Spring Boot
configuration properties binding as described in
https://github.com/spring-projects/spring-boot/issues/34483.

Closes gh-30201
pull/30204/head
Sébastien Deleuze 3 years ago
parent
commit
7cc72ddf7a
  1. 5
      spring-core/src/main/java/org/springframework/aot/hint/support/ObjectToObjectConverterRuntimeHints.java

5
spring-core/src/main/java/org/springframework/aot/hint/support/ObjectToObjectConverterRuntimeHints.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -43,6 +43,9 @@ class ObjectToObjectConverterRuntimeHints implements RuntimeHintsRegistrar { @@ -43,6 +43,9 @@ class ObjectToObjectConverterRuntimeHints implements RuntimeHintsRegistrar {
.onReachableType(sqlDateTypeReference)
.withMethod("valueOf", List.of(TypeReference.of(LocalDate.class)), ExecutableMode.INVOKE)
.onReachableType(sqlDateTypeReference));
hints.reflection().registerTypeIfPresent(classLoader, "org.springframework.http.HttpMethod",
builder -> builder.withMethod("valueOf", List.of(TypeReference.of(String.class)), ExecutableMode.INVOKE));
}
}

Loading…
Cancel
Save