You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix hints for @Bean config props that could be constructor bound
Previously, if a `@ConfigurationProperties`-annotated `@Bean` method
returned a type that looked like it could be constructor bound, the
registered runtime hints were incorrect. With only the bean's class
to work with, the hints registrar would incorrectly determine that
the type would be constructor bound and would not register the hints
required for Java bean binding.
This commit updates the registrar to allow the caller to provide a
Bindable which knows both what should be bound and how it should be
bound, thereby allowing the registrar to generate the correct hints.
The tests for the AOT processor have also been updated to remove
duplication of the tests in BindableRuntimeHintsRegistrarTests and
to focus on the contribution creating Bindable instances with the
bind method that is required to produce the correct reflection hints.
Closesgh-35564
Co-authored-by: Phillip Webb <[email protected]>
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanFactoryInitializationAotProcessor.java
+17-14Lines changed: 17 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2012-2022 the original author or authors.
2
+
* Copyright 2012-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrar.java
+46-13Lines changed: 46 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@
24
24
importjava.util.HashSet;
25
25
importjava.util.Map;
26
26
importjava.util.Set;
27
+
importjava.util.stream.Stream;
27
28
importjava.util.stream.StreamSupport;
28
29
29
30
importkotlin.jvm.JvmClassMappingKt;
@@ -51,8 +52,8 @@
51
52
* {@link RuntimeHintsRegistrar} that can be used to register {@link ReflectionHints} for
52
53
* {@link Bindable} types, discovering any nested type it may expose through a property.
53
54
* <p>
54
-
* This class can be used as a base-class, or instantiated using the {@code forTypes}
55
-
* factory methods.
55
+
* This class can be used as a base-class, or instantiated using the {@code forTypes} and
0 commit comments