Introduce 'value' alias for @Bean's 'name' attribute

In order to simplify configuration for use cases involving @Bean where
only a bean name or aliases are supplied as an attribute, this commit
introduces a new 'value' attribute that is an @AliasFor 'name' in @Bean.

Issue: SPR-14728
This commit is contained in:
Sam Brannen
2016-09-17 16:01:08 +02:00
parent 778ef02680
commit 8f62b63663
4 changed files with 114 additions and 53 deletions

View File

@@ -333,10 +333,10 @@ public class WebMvcConfigurationSupportTests {
@EnableWebMvc
@Configuration @SuppressWarnings("unused")
@Configuration
static class WebConfig {
@Bean(name="/testController")
@Bean("/testController")
public TestController testController() {
return new TestController();
}
@@ -350,7 +350,7 @@ public class WebMvcConfigurationSupportTests {
}
@Configuration @SuppressWarnings("unused")
@Configuration
static class ViewResolverConfig {
@Bean
@@ -387,7 +387,7 @@ public class WebMvcConfigurationSupportTests {
}
@Controller @SuppressWarnings("unused")
@Controller
private static class TestController {
@RequestMapping("/")
@@ -413,7 +413,7 @@ public class WebMvcConfigurationSupportTests {
@Controller
@Scope(value="prototype", proxyMode=ScopedProxyMode.TARGET_CLASS)
@Scope(scopeName = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
static class ScopedProxyController {
@RequestMapping("/scopedProxy")