From b9c04fb14bd3a7a1901a53d1453893074cf4a72b Mon Sep 17 00:00:00 2001 From: buildmaster Date: Thu, 28 Jun 2018 14:19:20 +0000 Subject: [PATCH 1/4] Update SNAPSHOT to 1.3.4.RELEASE --- docs/pom.xml | 2 +- pom.xml | 4 ++-- spring-cloud-commons-dependencies/pom.xml | 4 ++-- spring-cloud-commons/pom.xml | 2 +- spring-cloud-context/pom.xml | 2 +- spring-cloud-starter/pom.xml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/pom.xml b/docs/pom.xml index 86e8723a..3379a6e6 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-commons-parent - 1.3.4.BUILD-SNAPSHOT + 1.3.4.RELEASE pom Spring Cloud Commons Docs diff --git a/pom.xml b/pom.xml index 7d2886dc..802e2358 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.springframework.cloud spring-cloud-commons-parent - 1.3.4.BUILD-SNAPSHOT + 1.3.4.RELEASE pom Spring Cloud Commons Parent Spring Cloud Commons Parent @@ -11,7 +11,7 @@ org.springframework.cloud spring-cloud-build - 1.3.8.RELEASE + 1.3.10.RELEASE diff --git a/spring-cloud-commons-dependencies/pom.xml b/spring-cloud-commons-dependencies/pom.xml index cd89d5f5..29640c3c 100644 --- a/spring-cloud-commons-dependencies/pom.xml +++ b/spring-cloud-commons-dependencies/pom.xml @@ -5,11 +5,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 1.3.8.BUILD-SNAPSHOT + 1.3.10.RELEASE spring-cloud-commons-dependencies - 1.3.4.BUILD-SNAPSHOT + 1.3.4.RELEASE pom spring-cloud-commons-dependencies Spring Cloud Commons Dependencies diff --git a/spring-cloud-commons/pom.xml b/spring-cloud-commons/pom.xml index 95603da1..87351742 100644 --- a/spring-cloud-commons/pom.xml +++ b/spring-cloud-commons/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-commons-parent - 1.3.4.BUILD-SNAPSHOT + 1.3.4.RELEASE .. spring-cloud-commons diff --git a/spring-cloud-context/pom.xml b/spring-cloud-context/pom.xml index 09e625c2..4ec04b24 100644 --- a/spring-cloud-context/pom.xml +++ b/spring-cloud-context/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-commons-parent - 1.3.4.BUILD-SNAPSHOT + 1.3.4.RELEASE .. spring-cloud-context diff --git a/spring-cloud-starter/pom.xml b/spring-cloud-starter/pom.xml index 8f635929..3389f488 100644 --- a/spring-cloud-starter/pom.xml +++ b/spring-cloud-starter/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-commons-parent - 1.3.4.BUILD-SNAPSHOT + 1.3.4.RELEASE spring-cloud-starter spring-cloud-starter From 9896cb7062e29ce414c4c52ef78b2a3d5cdaa43b Mon Sep 17 00:00:00 2001 From: buildmaster Date: Thu, 28 Jun 2018 14:20:21 +0000 Subject: [PATCH 2/4] Going back to snapshots --- docs/pom.xml | 2 +- pom.xml | 4 ++-- spring-cloud-commons-dependencies/pom.xml | 4 ++-- spring-cloud-commons/pom.xml | 2 +- spring-cloud-context/pom.xml | 2 +- spring-cloud-starter/pom.xml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/pom.xml b/docs/pom.xml index 3379a6e6..86e8723a 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-commons-parent - 1.3.4.RELEASE + 1.3.4.BUILD-SNAPSHOT pom Spring Cloud Commons Docs diff --git a/pom.xml b/pom.xml index 802e2358..7d2886dc 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.springframework.cloud spring-cloud-commons-parent - 1.3.4.RELEASE + 1.3.4.BUILD-SNAPSHOT pom Spring Cloud Commons Parent Spring Cloud Commons Parent @@ -11,7 +11,7 @@ org.springframework.cloud spring-cloud-build - 1.3.10.RELEASE + 1.3.8.RELEASE diff --git a/spring-cloud-commons-dependencies/pom.xml b/spring-cloud-commons-dependencies/pom.xml index 29640c3c..cd89d5f5 100644 --- a/spring-cloud-commons-dependencies/pom.xml +++ b/spring-cloud-commons-dependencies/pom.xml @@ -5,11 +5,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 1.3.10.RELEASE + 1.3.8.BUILD-SNAPSHOT spring-cloud-commons-dependencies - 1.3.4.RELEASE + 1.3.4.BUILD-SNAPSHOT pom spring-cloud-commons-dependencies Spring Cloud Commons Dependencies diff --git a/spring-cloud-commons/pom.xml b/spring-cloud-commons/pom.xml index 87351742..95603da1 100644 --- a/spring-cloud-commons/pom.xml +++ b/spring-cloud-commons/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-commons-parent - 1.3.4.RELEASE + 1.3.4.BUILD-SNAPSHOT .. spring-cloud-commons diff --git a/spring-cloud-context/pom.xml b/spring-cloud-context/pom.xml index 4ec04b24..09e625c2 100644 --- a/spring-cloud-context/pom.xml +++ b/spring-cloud-context/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-commons-parent - 1.3.4.RELEASE + 1.3.4.BUILD-SNAPSHOT .. spring-cloud-context diff --git a/spring-cloud-starter/pom.xml b/spring-cloud-starter/pom.xml index 3389f488..8f635929 100644 --- a/spring-cloud-starter/pom.xml +++ b/spring-cloud-starter/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-commons-parent - 1.3.4.RELEASE + 1.3.4.BUILD-SNAPSHOT spring-cloud-starter spring-cloud-starter From d711556fe8c60cf67b11ba931160c1de973aaf5f Mon Sep 17 00:00:00 2001 From: buildmaster Date: Thu, 28 Jun 2018 14:20:22 +0000 Subject: [PATCH 3/4] Bumping versions to 1.3.5.BUILD-SNAPSHOT after release --- docs/pom.xml | 2 +- pom.xml | 4 ++-- spring-cloud-commons-dependencies/pom.xml | 4 ++-- spring-cloud-commons/pom.xml | 2 +- spring-cloud-context/pom.xml | 2 +- spring-cloud-starter/pom.xml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/pom.xml b/docs/pom.xml index 86e8723a..2bc6addd 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-commons-parent - 1.3.4.BUILD-SNAPSHOT + 1.3.5.BUILD-SNAPSHOT pom Spring Cloud Commons Docs diff --git a/pom.xml b/pom.xml index 7d2886dc..1f6ae661 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.springframework.cloud spring-cloud-commons-parent - 1.3.4.BUILD-SNAPSHOT + 1.3.5.BUILD-SNAPSHOT pom Spring Cloud Commons Parent Spring Cloud Commons Parent @@ -11,7 +11,7 @@ org.springframework.cloud spring-cloud-build - 1.3.8.RELEASE + 1.3.10.RELEASE diff --git a/spring-cloud-commons-dependencies/pom.xml b/spring-cloud-commons-dependencies/pom.xml index cd89d5f5..1ca4c6eb 100644 --- a/spring-cloud-commons-dependencies/pom.xml +++ b/spring-cloud-commons-dependencies/pom.xml @@ -5,11 +5,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 1.3.8.BUILD-SNAPSHOT + 1.3.10.RELEASE spring-cloud-commons-dependencies - 1.3.4.BUILD-SNAPSHOT + 1.3.5.BUILD-SNAPSHOT pom spring-cloud-commons-dependencies Spring Cloud Commons Dependencies diff --git a/spring-cloud-commons/pom.xml b/spring-cloud-commons/pom.xml index 95603da1..55a9a9b0 100644 --- a/spring-cloud-commons/pom.xml +++ b/spring-cloud-commons/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-commons-parent - 1.3.4.BUILD-SNAPSHOT + 1.3.5.BUILD-SNAPSHOT .. spring-cloud-commons diff --git a/spring-cloud-context/pom.xml b/spring-cloud-context/pom.xml index 09e625c2..1fb13099 100644 --- a/spring-cloud-context/pom.xml +++ b/spring-cloud-context/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-commons-parent - 1.3.4.BUILD-SNAPSHOT + 1.3.5.BUILD-SNAPSHOT .. spring-cloud-context diff --git a/spring-cloud-starter/pom.xml b/spring-cloud-starter/pom.xml index 8f635929..6b76c1a3 100644 --- a/spring-cloud-starter/pom.xml +++ b/spring-cloud-starter/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-commons-parent - 1.3.4.BUILD-SNAPSHOT + 1.3.5.BUILD-SNAPSHOT spring-cloud-starter spring-cloud-starter From 1de9d12150525c75e7f76eb1d0dbe11ebada6237 Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Wed, 11 Jul 2018 16:01:14 -0400 Subject: [PATCH 4/4] Extract target class code into utility class (#391) * Extract target class code into utility class --- .../ConfigurationPropertiesRebinder.java | 17 +------- .../cloud/util/ProxyUtils.java | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 spring-cloud-context/src/main/java/org/springframework/cloud/util/ProxyUtils.java 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 a5350b44..8c8e5c60 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 @@ -20,7 +20,6 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; import org.springframework.beans.BeansException; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -34,6 +33,7 @@ import org.springframework.jmx.export.annotation.ManagedAttribute; import org.springframework.jmx.export.annotation.ManagedOperation; import org.springframework.jmx.export.annotation.ManagedResource; import org.springframework.stereotype.Component; +import org.springframework.cloud.util.ProxyUtils; /** * Listens for {@link EnvironmentChangeEvent} and rebinds beans that were bound to the @@ -94,7 +94,7 @@ public class ConfigurationPropertiesRebinder try { Object bean = this.applicationContext.getBean(name); if (AopUtils.isAopProxy(bean)) { - bean = getTargetObject(bean); + bean = ProxyUtils.getTargetObject(bean); } this.applicationContext.getAutowireCapableBeanFactory().destroyBean(bean); this.applicationContext.getAutowireCapableBeanFactory() @@ -109,19 +109,6 @@ public class ConfigurationPropertiesRebinder return false; } - @SuppressWarnings("unchecked") - private 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; - } - @ManagedAttribute public Set getBeanNames() { return new HashSet(this.beans.getBeanNames()); 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 new file mode 100644 index 00000000..57549c43 --- /dev/null +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/util/ProxyUtils.java @@ -0,0 +1,39 @@ +/* + * Copyright 2013-2018 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.util; + +import org.springframework.aop.framework.Advised; +import org.springframework.aop.support.AopUtils; + +/** + * @author Ryan Baxter + */ +public 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; + } +}