Fix @ConfigurationProperties on @Bean methods without metadata caching
Due to a current limitation of Spring Framework, when bean metadata caching is disabled, a merged bean definition may have a null resolved factory method that would have been non-null if bean metadata caching was enabled. Configuration property binding for @Bean methods annotated with @ConfigurationProperties relied upon the resolved factory method being enabled to find the @ConfigurationProperties annotation and trigger property binding. As a result, when bean metadata caching is disabled on the bean factory, such @ConfigurationProperties beans would not be bound. This commit works around the limitation by adding a fallback that performs a reflection-based search for the factory method when the resolved factory method on the bean definition is null. This allows the bean's factory method and any @ConfigurationProperties annotation on it to be found, ensuring that propoerty binding is then performed. Fixes gh-18440
Showing
Please register or sign in to comment