Use unique testRestTemplate bean name

Update `SpringBootTestContextCustomizer` to use the full qualified
TestRestTemplate as the registered bean name. Prior to this commit it
was possible that the customizer would replace the relatively common
bean name `testRestTemplate`.

Fixes gh-7711
This commit is contained in:
Phillip Webb
2016-12-21 11:18:24 -08:00
parent c23d8fb375
commit 138b96cf5f
3 changed files with 70 additions and 1 deletions

View File

@@ -62,7 +62,7 @@ class SpringBootTestContextCustomizer implements ContextCustomizer {
private void registerTestRestTemplate(ConfigurableApplicationContext context,
BeanDefinitionRegistry registry) {
registry.registerBeanDefinition("testRestTemplate",
registry.registerBeanDefinition(TestRestTemplate.class.getName(),
new RootBeanDefinition(TestRestTemplateFactory.class));
}