Don't rebind beans with no implementation.

fixes gh-337
This commit is contained in:
Spencer Gibb
2018-03-16 13:53:59 -04:00
parent 529739d3b6
commit 78d25f0fc0
2 changed files with 18 additions and 4 deletions

View File

@@ -17,9 +17,11 @@ package org.springframework.cloud.context.properties;
import javax.annotation.PostConstruct;
import org.aopalliance.intercept.MethodInterceptor;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
@@ -117,6 +119,16 @@ public class ConfigurationPropertiesRebinderIntegrationTests {
return new TestProperties();
}
// exposes https://github.com/spring-cloud/spring-cloud-commons/issues/337
@Bean
@ConfigurationProperties("some.service")
public SomeService someService() {
return ProxyFactory.getProxy(SomeService.class, (MethodInterceptor) methodInvocation -> null);
}
}
interface SomeService {
void foo();
}
// Hack out a protected inner class for testing