Add support for @Priority

This commit adds support for @Priority to filter multiple candidates
for autowiring. When multiple candidates are available for a given
bean, the bean annotated with @Primary is used. If none exists, the
one with the higher value for the @Priority annotation is used. If
two beans have the same priority a NoUniqueBeanDefinitionException
is thrown, just as if two beans are annotated with @Primary.

The underlying code for #getBean and #resolveDependency has been
merged as this feature is available for both dependency injection
and bean lookup by type.

Issue: SPR-10548
This commit is contained in:
Stephane Nicoll
2014-01-14 14:22:31 +01:00
parent 48221798f5
commit 5fe8f52c02
3 changed files with 199 additions and 24 deletions

View File

@@ -280,7 +280,8 @@ project("spring-beans") {
optional("javax.inject:javax.inject:1")
optional("javax.el:javax.el-api:2.2.4")
testCompile("log4j:log4j:1.2.17")
}
testCompile("org.apache.tomcat.embed:tomcat-embed-core:8.0.0-RC10")
}
}
project("spring-beans-groovy") {