From a1a8a8cef03504795cbcb7b64aa0e154585e77f3 Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Thu, 15 Nov 2018 14:54:52 +0100 Subject: [PATCH] Avoid instantiation of BeanPropertyBinder in Binder Closes gh-15181 --- .../springframework/boot/context/properties/bind/Binder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java index 58ca94ebe6a..8f746fdd7d7 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java @@ -333,12 +333,12 @@ public class Binder { || isUnbindableBean(name, target, context)) { return null; } - BeanPropertyBinder propertyBinder = (propertyName, propertyTarget) -> bind( - name.append(propertyName), propertyTarget, handler, context, false); Class type = target.getType().resolve(Object.class); if (!allowRecursiveBinding && context.hasBoundBean(type)) { return null; } + BeanPropertyBinder propertyBinder = (propertyName, propertyTarget) -> bind( + name.append(propertyName), propertyTarget, handler, context, false); return context.withBean(type, () -> { Stream boundBeans = BEAN_BINDERS.stream() .map((b) -> b.bind(name, target, context, propertyBinder));