diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/context/properties/ConfigurationPropertiesRebinder.java b/spring-cloud-context/src/main/java/org/springframework/cloud/context/properties/ConfigurationPropertiesRebinder.java index 657c3a5b..f3f766fe 100644 --- a/spring-cloud-context/src/main/java/org/springframework/cloud/context/properties/ConfigurationPropertiesRebinder.java +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/context/properties/ConfigurationPropertiesRebinder.java @@ -94,7 +94,7 @@ public class ConfigurationPropertiesRebinder try { Object bean = this.applicationContext.getBean(name); if (AopUtils.isAopProxy(bean)) { - bean = ProxyUtils.getUltimateTargetObject(bean); + bean = ProxyUtils.getTargetObject(bean); } if (bean != null) { // TODO: determine a more general approach to fix this. diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/util/ProxyUtils.java b/spring-cloud-context/src/main/java/org/springframework/cloud/util/ProxyUtils.java index 2558d05f..6dfb5528 100644 --- a/spring-cloud-context/src/main/java/org/springframework/cloud/util/ProxyUtils.java +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/util/ProxyUtils.java @@ -31,25 +31,12 @@ public final class ProxyUtils { @SuppressWarnings("unchecked") public static T getTargetObject(Object candidate) { - try { - if (AopUtils.isAopProxy(candidate) && (candidate instanceof Advised)) { - return (T) ((Advised) candidate).getTargetSource().getTarget(); - } - } - catch (Exception ex) { - throw new IllegalStateException("Failed to unwrap proxied object", ex); - } - return (T) candidate; - } - - @SuppressWarnings("unchecked") - public static T getUltimateTargetObject(Object candidate) { Assert.notNull(candidate, "Candidate must not be null"); try { if (AopUtils.isAopProxy(candidate) && candidate instanceof Advised) { Object target = ((Advised) candidate).getTargetSource().getTarget(); if (target != null) { - return (T) getUltimateTargetObject(target); + return (T) getTargetObject(target); } } }