Class LookupOverride
java.lang.Object
org.springframework.beans.factory.support.MethodOverride
org.springframework.beans.factory.support.LookupOverride
- All Implemented Interfaces:
BeanMetadataElement
Represents an override of a method that looks up an object in the same IoC context,
either by bean name or by bean type (based on the declared method return type).
Methods eligible for lookup override may declare arguments in which case the given arguments are passed to the bean retrieval operation.
- Since:
- 1.1
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
-
Constructor Summary
ConstructorDescriptionLookupOverride
(Method method, String beanName) Construct a new LookupOverride.LookupOverride
(String methodName, String beanName) Construct a new LookupOverride. -
Method Summary
Methods inherited from class org.springframework.beans.factory.support.MethodOverride
getMethodName, getSource, isOverloaded, setOverloaded, setSource
-
Constructor Details
-
LookupOverride
Construct a new LookupOverride.- Parameters:
methodName
- the name of the method to overridebeanName
- the name of the bean in the currentBeanFactory
that the overridden method should return (may benull
for type-based bean retrieval)
-
LookupOverride
Construct a new LookupOverride.- Parameters:
method
- the method declaration to overridebeanName
- the name of the bean in the currentBeanFactory
that the overridden method should return (may benull
for type-based bean retrieval)
-
-
Method Details
-
getBeanName
Return the name of the bean that should be returned by this method. -
matches
Match the specified method byMethod
reference or method name.For backwards compatibility reasons, in a scenario with overloaded non-abstract methods of the given name, only the no-arg variant of a method will be turned into a container-driven lookup method.
In case of a provided
Method
, only straight matches will be considered, usually demarcated by the@Lookup
annotation.- Specified by:
matches
in classMethodOverride
- Parameters:
method
- the method to check- Returns:
- whether this override matches the given method
-
equals
- Overrides:
equals
in classMethodOverride
-
hashCode
public int hashCode()- Overrides:
hashCode
in classMethodOverride
-
toString
-