From 7cc72ddf7a39cf1c52c281dc4ddda71cb95dc77a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Mon, 27 Mar 2023 15:13:15 +0200 Subject: [PATCH] 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 --- .../hint/support/ObjectToObjectConverterRuntimeHints.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-core/src/main/java/org/springframework/aot/hint/support/ObjectToObjectConverterRuntimeHints.java b/spring-core/src/main/java/org/springframework/aot/hint/support/ObjectToObjectConverterRuntimeHints.java index 51d063c8b8..524ae5e9f9 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/support/ObjectToObjectConverterRuntimeHints.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/support/ObjectToObjectConverterRuntimeHints.java @@ -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 { .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)); } }