@ -89,30 +89,37 @@ public class ConfigurationPropertiesRebinder
@@ -89,30 +89,37 @@ public class ConfigurationPropertiesRebinder
if ( ! this . beans . getBeanNames ( ) . contains ( name ) ) {
return false ;
}
if ( this . applicationContext ! = null ) {
try {
Object bean = this . applicationContext . getBean ( name ) ;
if ( AopUtils . isAopProxy ( bean ) ) {
bean = ProxyUtils . getTargetObject ( bean ) ;
}
if ( bean ! = null ) {
// TODO: determine a more general approach to fix this.
// see https://github.com/spring-cloud/spring-cloud-commons/issues/571
if ( getNeverRefreshable ( ) . contains ( bean . getClass ( ) . getName ( ) ) ) {
return false ; // ignore
ApplicationContext appContext = this . applicationContext ;
while ( appContext ! = null ) {
if ( appContext . containsLocalBean ( name ) ) {
try {
Object bean = appContext . getBean ( name ) ;
if ( AopUtils . isAopProxy ( bean ) ) {
bean = ProxyUtils . getTargetObject ( bean ) ;
}
if ( bean ! = null ) {
// TODO: determine a more general approach to fix this.
// see
// https://github.com/spring-cloud/spring-cloud-commons/issues/571
if ( getNeverRefreshable ( ) . contains ( bean . getClass ( ) . getName ( ) ) ) {
return false ; // ignore
}
appContext . getAutowireCapableBeanFactory ( ) . destroyBean ( bean ) ;
appContext . getAutowireCapableBeanFactory ( ) . initializeBean ( bean , name ) ;
return true ;
}
this . applicationContext . getAutowireCapableBeanFactory ( ) . destroyBean ( bean ) ;
this . applicationContext . getAutowireCapableBeanFactory ( ) . initializeBean ( bean , name ) ;
return true ;
}
catch ( RuntimeException e ) {
this . errors . put ( name , e ) ;
throw e ;
}
catch ( Exception e ) {
this . errors . put ( name , e ) ;
throw new IllegalStateException ( "Cannot rebind to " + name , e ) ;
}
}
catch ( RuntimeException e ) {
this . errors . put ( name , e ) ;
throw e ;
}
catch ( Exception e ) {
this . errors . put ( name , e ) ;
throw new IllegalStateException ( "Cannot rebind to " + name , e ) ;
else {
appContext = appContext . getParent ( ) ;
}
}
return false ;