ResolvableType-based type matching at the BeanFactory API level

Issue: SPR-12147
This commit is contained in:
Juergen Hoeller
2015-03-18 23:05:13 +01:00
parent a3e5fbf5ed
commit 778a01943b
14 changed files with 323 additions and 102 deletions

View File

@@ -38,6 +38,7 @@ import org.springframework.context.MessageSource;
import org.springframework.context.MessageSourceResolvable;
import org.springframework.context.NoSuchMessageException;
import org.springframework.context.support.DelegatingMessageSource;
import org.springframework.core.ResolvableType;
import org.springframework.core.env.Environment;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.io.Resource;
@@ -98,6 +99,7 @@ class StubWebApplicationContext implements WebApplicationContext {
return this.servletContext;
}
//---------------------------------------------------------------------
// Implementation of ApplicationContext interface
//---------------------------------------------------------------------
@@ -146,6 +148,7 @@ class StubWebApplicationContext implements WebApplicationContext {
}
}
//---------------------------------------------------------------------
// Implementation of BeanFactory interface
//---------------------------------------------------------------------
@@ -190,6 +193,11 @@ class StubWebApplicationContext implements WebApplicationContext {
return this.beanFactory.isPrototype(name);
}
@Override
public boolean isTypeMatch(String name, ResolvableType targetType) throws NoSuchBeanDefinitionException {
return this.beanFactory.isTypeMatch(name, targetType);
}
@Override
public boolean isTypeMatch(String name, Class<?> targetType) throws NoSuchBeanDefinitionException {
return this.beanFactory.isTypeMatch(name, targetType);
@@ -205,6 +213,7 @@ class StubWebApplicationContext implements WebApplicationContext {
return this.beanFactory.getAliases(name);
}
//---------------------------------------------------------------------
// Implementation of ListableBeanFactory interface
//---------------------------------------------------------------------
@@ -224,6 +233,11 @@ class StubWebApplicationContext implements WebApplicationContext {
return this.beanFactory.getBeanDefinitionNames();
}
@Override
public String[] getBeanNamesForType(ResolvableType type) {
return this.beanFactory.getBeanNamesForType(type);
}
@Override
public String[] getBeanNamesForType(Class<?> type) {
return this.beanFactory.getBeanNamesForType(type);
@@ -265,6 +279,7 @@ class StubWebApplicationContext implements WebApplicationContext {
return this.beanFactory.findAnnotationOnBean(beanName, annotationType);
}
//---------------------------------------------------------------------
// Implementation of HierarchicalBeanFactory interface
//---------------------------------------------------------------------
@@ -279,6 +294,7 @@ class StubWebApplicationContext implements WebApplicationContext {
return this.beanFactory.containsBean(name);
}
//---------------------------------------------------------------------
// Implementation of MessageSource interface
//---------------------------------------------------------------------
@@ -298,6 +314,7 @@ class StubWebApplicationContext implements WebApplicationContext {
return this.messageSource.getMessage(resolvable, locale);
}
//---------------------------------------------------------------------
// Implementation of ResourceLoader interface
//---------------------------------------------------------------------
@@ -312,6 +329,7 @@ class StubWebApplicationContext implements WebApplicationContext {
return this.resourcePatternResolver.getResource(location);
}
//---------------------------------------------------------------------
// Other
//---------------------------------------------------------------------