Class ResourceElementResolver
java.lang.Object
org.springframework.context.annotation.ResourceElementResolver
Resolver for the injection of named beans on a field or method element,
following the rules of the
Resource
annotation
but without any JNDI support. This is primarily intended for AOT processing.- Since:
- 6.1.2
- Author:
- Stephane Nicoll, Juergen Hoeller
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceElementResolver
Create a newResourceElementResolver.ResourceFieldResolver
for the specified field.static ResourceElementResolver
Create a newResourceElementResolver.ResourceFieldResolver
for the specified field and resource name.static ResourceElementResolver
Create a newResourceElementResolver.ResourceMethodResolver
for the specified method using a resource name that infers from the method name.static ResourceElementResolver
Create a newResourceElementResolver.ResourceMethodResolver
for the specified method and resource name.<T> T
resolve
(RegisteredBean registeredBean) Resolve the value for the specified registered bean.abstract void
resolveAndSet
(RegisteredBean registeredBean, Object instance) Resolve the value for the specified registered bean and set it using reflection.
-
Method Details
-
forField
Create a newResourceElementResolver.ResourceFieldResolver
for the specified field.- Parameters:
fieldName
- the field name- Returns:
- a new
ResourceElementResolver.ResourceFieldResolver
instance
-
forField
Create a newResourceElementResolver.ResourceFieldResolver
for the specified field and resource name.- Parameters:
fieldName
- the field nameresourceName
- the resource name- Returns:
- a new
ResourceElementResolver.ResourceFieldResolver
instance
-
forMethod
Create a newResourceElementResolver.ResourceMethodResolver
for the specified method using a resource name that infers from the method name.- Parameters:
methodName
- the method nameparameterType
- the parameter type.- Returns:
- a new
ResourceElementResolver.ResourceMethodResolver
instance
-
forMethod
public static ResourceElementResolver forMethod(String methodName, Class<?> parameterType, String resourceName) Create a newResourceElementResolver.ResourceMethodResolver
for the specified method and resource name.- Parameters:
methodName
- the method nameparameterType
- the parameter typeresourceName
- the resource name- Returns:
- a new
ResourceElementResolver.ResourceMethodResolver
instance
-
resolve
Resolve the value for the specified registered bean.- Parameters:
registeredBean
- the registered bean- Returns:
- the resolved field or method parameter value
-
resolveAndSet
Resolve the value for the specified registered bean and set it using reflection.- Parameters:
registeredBean
- the registered beaninstance
- the bean instance
-