Register env repo properties as beans.

The `CompositeEnvironmentBeanFactoryPostProcessor` binds the required properties for a EnvironmentRepositoryFactory, but does not register it as a bean. This is now done with a supplier to the bound instance.

Fixes gh-1720
This commit is contained in:
spencergibb
2021-03-29 16:25:33 -04:00
parent 55bba36e2f
commit e7be2b8c5a
2 changed files with 19 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointPr
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties;
import org.springframework.cloud.config.server.test.ConfigServerTestUtils;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.junit4.SpringRunner;
@@ -107,4 +108,12 @@ public class ApplicationBootstrapTests {
assertThat(property).containsEntry("value", "bar");
}
@Test
public void propertiesBeansRegisterByCompositeEnvBeanFactoryPostProcessor() {
String[] beanNames = server
.getBeanNamesForType(MultipleJGitEnvironmentProperties.class);
assertThat(beanNames).isNotNull()
.anyMatch(s -> s.matches("git-env-repo-properties\\d"));
}
}