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 ResourceElementResolverCreate a newResourceElementResolver.ResourceFieldResolverfor the specified field.static ResourceElementResolverCreate a newResourceElementResolver.ResourceFieldResolverfor the specified field and resource name.static ResourceElementResolverCreate a newResourceElementResolver.ResourceMethodResolverfor the specified method using a resource name that infers from the method name.static ResourceElementResolverCreate a newResourceElementResolver.ResourceMethodResolverfor the specified method and resource name.<T> Tresolve(RegisteredBean registeredBean) Resolve the value for the specified registered bean.abstract voidresolveAndSet(RegisteredBean registeredBean, Object instance) Resolve the value for the specified registered bean and set it using reflection.
-
Method Details
-
forField
Create a newResourceElementResolver.ResourceFieldResolverfor the specified field.- Parameters:
fieldName- the field name- Returns:
- a new
ResourceElementResolver.ResourceFieldResolverinstance
-
forField
Create a newResourceElementResolver.ResourceFieldResolverfor the specified field and resource name.- Parameters:
fieldName- the field nameresourceName- the resource name- Returns:
- a new
ResourceElementResolver.ResourceFieldResolverinstance
-
forMethod
Create a newResourceElementResolver.ResourceMethodResolverfor 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.ResourceMethodResolverinstance
-
forMethod
public static ResourceElementResolver forMethod(String methodName, Class<?> parameterType, String resourceName) Create a newResourceElementResolver.ResourceMethodResolverfor the specified method and resource name.- Parameters:
methodName- the method nameparameterType- the parameter typeresourceName- the resource name- Returns:
- a new
ResourceElementResolver.ResourceMethodResolverinstance
-
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
-