Also supports discovering and invoking exception handling methods to process exceptions raised during message handling.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private ApplicationContext | |
| private ArgumentResolverConfigurer | |
| private String | |
| private final Map | |
| private final Map | |
| private Predicate | |
| pack-priv List | |
| private final InvocableHelper | |
| protected final Log | |
| private ReturnValueHandlerConfigurer | |
| private static final String | SCOPED_TARGET_NAME_PREFIX
Bean name prefix for target beans behind scoped proxies. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | addMatchesToCollection(Collection<T> mappingsToCheck, Message<?> message, List<AbstractMethodMessageHandler.
|
| public void | afterPropertiesSet()
Implements org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. |
| protected abstract AbstractExceptionHandlerMethodResolver | Returns: the resolver to usethe class in which an exception occurred during handling beanType)Create a concrete instance of |
| private HandlerMethod | createHandlerMethod(Object handler, Method method)
Create a HandlerMethod instance from an Object handler that is either a handler instance or a String-based bean name. |
| protected final void | detectHandlerMethods(Object
the handler to check, either an instance of a Spring bean name handler)Detect if the given handler has any methods that can handle messages and if so register it with the extracted mapping information. |
| protected T | Returns: a new mapping or the samethe mapping to be added mapping, HandlerMethod the target handler for the mapping handlerMethod)This method is invoked just before mappings are added. |
| private String | |
| public ApplicationContext | |
| public ArgumentResolverConfigurer | |
| protected HandlerMethodArgumentResolverComposite | |
| public String | |
| protected abstract RouteMatcher. | |
| public MultiValueMap | getDestinationLookup()
Return a read-only multi-value map with a direct lookup of mappings, (e.g. for non-pattern destinations). |
| protected abstract Set | getDirectLookupMappings(T mapping)
Return String-based destinations for the given mapping, if any, that can be used to find matches with a direct lookup (i.e. non-patterns). |
| private AbstractMethodMessageHandler. | |
| public Map | |
| public Predicate | |
| protected abstract Comparator | Returns: the comparator, nevernullthe current Message message)Return a comparator for sorting matching mappings. |
| protected abstract T | Returns: the mapping, ornull if the method is not mappedthe method to check method, Class<?> the handler type, possibly a subtype of the method's declaring class handlerType)Obtain the mapping for the given method, if any. |
| protected abstract T | Returns: the match ornull if there is no matchthe mapping to get a match for mapping, Message<?> the message being handled message)Check if a mapping matches the current message and return a possibly new mapping with conditions relevant to the current request. |
| public ReactiveAdapterRegistry | |
| public ReturnValueHandlerConfigurer | |
| protected Mono | |
| public Mono | handleMessage(Message<?>
the message to be handled message)Implements org. Handle the given message. |
| protected void | handleNoMatch(RouteMatcher.
the destination destination,the message message)Invoked when no matching handler is found. |
| protected abstract List | |
| private void | |
| protected abstract List | |
| protected void | registerExceptionHandlerAdvice(MessagingAdviceBean bean, AbstractExceptionHandlerMethodResolver resolver)
Subclasses can invoke this method to populate the MessagingAdviceBean cache
(e.g. to support "global" |
| public final void | registerHandlerMethod(Object
the bean name of the handler or the handler instance handler, Method the method to register method, T the mapping conditions associated with the handler method mapping)Register a handler method and its unique mapping. |
| public void | setApplicationContext(ApplicationContext
the ApplicationContext object to be used by this object applicationContext)Implements org. Set the ApplicationContext that this object runs in. Normally this call will be used to initialize the object. |
| public void | setArgumentResolverConfigurer(ArgumentResolverConfigurer configurer)
Configure custom resolvers for handler method arguments. |
| public void | setBeanName(String
the name of the bean in the factory.
Note that this name is the actual bean name used in the factory, which may
differ from the originally specified name: in particular for inner bean
names, the actual bean name might have been made unique through appending
"#..." suffixes. Use the name)BeanFactoryUtils#originalBeanName(String)
method to extract the original bean name (without suffix), if desired.Implements org. Set the name of the bean in the bean factory that created this bean. |
| public void | setHandlerPredicate(Predicate<Class<?>> handlerPredicate)
Configure a predicate for selecting which Spring beans to check for the presence of message handler methods. |
| public void | setHandlers(List<Object>
the handlers to check handlers)Manually configure the handlers to check for the presence of message
handling methods, which also disables auto-detection via a
|
| public void | setReactiveAdapterRegistry(ReactiveAdapterRegistry registry)
Configure the registry for adapting various reactive types. |
| public void | setReturnValueHandlerConfigurer(ReturnValueHandlerConfigurer configurer)
Configure custom return value handlers for handler methods. |
| applicationContext | back to summary |
|---|---|
| private ApplicationContext applicationContext
| |
| argumentResolverConfigurer | back to summary |
|---|---|
| private ArgumentResolverConfigurer argumentResolverConfigurer | |
| beanName | back to summary |
|---|---|
| private String beanName
| |
| destinationLookup | back to summary |
|---|---|
| private final Map<String, List<T>> destinationLookup | |
| handlerMethods | back to summary |
|---|---|
| private final Map<T, HandlerMethod> handlerMethods | |
| handlerPredicate | back to summary |
|---|---|
| private Predicate<Class<?>> handlerPredicate
| |
| handlers | back to summary |
|---|---|
| pack-priv List<Object> handlers
| |
| invocableHelper | back to summary |
|---|---|
| private final InvocableHelper invocableHelper | |
| logger | back to summary |
|---|---|
| protected final Log logger | |
| returnValueHandlerConfigurer | back to summary |
|---|---|
| private ReturnValueHandlerConfigurer returnValueHandlerConfigurer | |
| SCOPED_TARGET_NAME_PREFIX | back to summary |
|---|---|
| private static final String SCOPED_TARGET_NAME_PREFIX Bean name prefix for target beans behind scoped proxies. Used to exclude those targets from handler method detection, in favor of the corresponding proxies. We're not checking the autowire-candidate status here, which is how the
proxy target filtering problem is being handled at the autowiring level,
since autowire-candidate may have been turned to Originally defined in | |
| AbstractMethodMessageHandler | back to summary |
|---|---|
| public AbstractMethodMessageHandler() | |
| addMatchesToCollection | back to summary |
|---|---|
| private void addMatchesToCollection(Collection<T> mappingsToCheck, Message<?> message, List<AbstractMethodMessageHandler. | |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() Implements org. Doc from org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
| |
| createExceptionMethodResolverFor | back to summary |
|---|---|
| protected abstract AbstractExceptionHandlerMethodResolver createExceptionMethodResolverFor(Class<?> beanType) Create a concrete instance of
| |
| createHandlerMethod | back to summary |
|---|---|
| private HandlerMethod createHandlerMethod(Object handler, Method method) Create a HandlerMethod instance from an Object handler that is either a handler instance or a String-based bean name. | |
| detectHandlerMethods | back to summary |
|---|---|
| protected final void detectHandlerMethods(Object handler) Detect if the given handler has any methods that can handle messages and if so register it with the extracted mapping information. Note This method is protected and can be invoked by
subclasses, but this should be done on startup only as documented in
| |
| extendMapping | back to summary |
|---|---|
| protected T extendMapping(T mapping, HandlerMethod handlerMethod) This method is invoked just before mappings are added. It allows
subclasses to update the mapping with the By default this method returns the mapping that is passed in.
| |
| formatMappings | back to summary |
|---|---|
| private String formatMappings(Class<?> userType, Map<Method, T> methods) | |
| getApplicationContext | back to summary |
|---|---|
public ApplicationContext getApplicationContext()
| |
| getArgumentResolverConfigurer | back to summary |
|---|---|
| public ArgumentResolverConfigurer getArgumentResolverConfigurer() Return the configured custom resolvers for handler method arguments. | |
| getArgumentResolvers | back to summary |
|---|---|
| protected HandlerMethodArgumentResolverComposite getArgumentResolvers() Return the argument resolvers initialized during
| |
| getBeanName | back to summary |
|---|---|
| public String getBeanName() | |
| getDestination | back to summary |
|---|---|
| protected abstract RouteMatcher. Extract the destination from the given message.
| |
| getDestinationLookup | back to summary |
|---|---|
| public MultiValueMap Return a read-only multi-value map with a direct lookup of mappings, (e.g. for non-pattern destinations). | |
| getDirectLookupMappings | back to summary |
|---|---|
| protected abstract Set Return String-based destinations for the given mapping, if any, that can be used to find matches with a direct lookup (i.e. non-patterns). Note This is completely optional. The mapping metadata for a subclass may support neither direct lookups, nor String based destinations. | |
| getHandlerMethod | back to summary |
|---|---|
private AbstractMethodMessageHandler.
| |
| getHandlerMethods | back to summary |
|---|---|
| public Map Return a read-only map with all handler methods and their mappings. | |
| getHandlerPredicate | back to summary |
|---|---|
| public Predicate Return the
| |
| getMappingComparator | back to summary |
|---|---|
| protected abstract Comparator Return a comparator for sorting matching mappings. The returned comparator should sort 'better' matches higher.
| |
| getMappingForMethod | back to summary |
|---|---|
| protected abstract T getMappingForMethod(Method method, Class<?> handlerType) Obtain the mapping for the given method, if any. | |
| getMatchingMapping | back to summary |
|---|---|
| protected abstract T getMatchingMapping(T mapping, Message<?> message) Check if a mapping matches the current message and return a possibly new mapping with conditions relevant to the current request. | |
| getReactiveAdapterRegistry | back to summary |
|---|---|
| public ReactiveAdapterRegistry getReactiveAdapterRegistry() Return the configured registry for adapting reactive types. | |
| getReturnValueHandlerConfigurer | back to summary |
|---|---|
| public ReturnValueHandlerConfigurer getReturnValueHandlerConfigurer() Return the configured return value handlers. | |
| handleMatch | back to summary |
|---|---|
| protected Mono | |
| handleMessage | back to summary |
|---|---|
| public Mono Implements org. Doc from org. Handle the given message. | |
| handleNoMatch | back to summary |
|---|---|
| protected void handleNoMatch(RouteMatcher. Invoked when no matching handler is found.
| |
| initArgumentResolvers | back to summary |
|---|---|
| protected abstract List Return the list of argument resolvers to use. Subclasses should also take into account custom argument types configured via
| |
| initHandlerMethods | back to summary |
|---|---|
| private void initHandlerMethods() | |
| initReturnValueHandlers | back to summary |
|---|---|
| protected abstract List Return the list of return value handlers to use. Subclasses should also take into account custom return value types configured
via | |
| registerExceptionHandlerAdvice | back to summary |
|---|---|
| protected void registerExceptionHandlerAdvice(MessagingAdviceBean bean, AbstractExceptionHandlerMethodResolver resolver) Subclasses can invoke this method to populate the MessagingAdviceBean cache
(e.g. to support "global" | |
| registerHandlerMethod | back to summary |
|---|---|
| public final void registerHandlerMethod(Object handler, Method method, T mapping) Register a handler method and its unique mapping. Note As of 5.3 this method is public (rather than protected) and can be used both at startup and at runtime.
| |
| setApplicationContext | back to summary |
|---|---|
| public void setApplicationContext(ApplicationContext applicationContext) Implements org. Doc from org. Set the ApplicationContext that this object runs in. Normally this call will be used to initialize the object. Invoked after population of normal bean properties but before an init callback such
as
| |
| setArgumentResolverConfigurer | back to summary |
|---|---|
| public void setArgumentResolverConfigurer(ArgumentResolverConfigurer configurer) Configure custom resolvers for handler method arguments. | |
| setBeanName | back to summary |
|---|---|
| public void setBeanName(String name) Implements org. Doc from org. Set the name of the bean in the bean factory that created this bean. Invoked after population of normal bean properties but before an
init callback such as
| |
| setHandlerPredicate | back to summary |
|---|---|
| public void setHandlerPredicate(Predicate<Class<?>> handlerPredicate) Configure a predicate for selecting which Spring beans to check for the presence of message handler methods. This is not set by default. However, subclasses may initialize it to
some default strategy (e.g.
| |
| setHandlers | back to summary |
|---|---|
| public void setHandlers(List<Object> handlers) Manually configure the handlers to check for the presence of message
handling methods, which also disables auto-detection via a
| |
| setReactiveAdapterRegistry | back to summary |
|---|---|
| public void setReactiveAdapterRegistry(ReactiveAdapterRegistry registry) Configure the registry for adapting various reactive types. By default this is an instance of | |
| setReturnValueHandlerConfigurer | back to summary |
|---|---|
| public void setReturnValueHandlerConfigurer(ReturnValueHandlerConfigurer configurer) Configure custom return value handlers for handler methods. | |
| Modifier and Type | Field and Description |
|---|---|
| private final HandlerMethod | |
| private final T |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public String |
| handlerMethod | back to summary |
|---|---|
| private final HandlerMethod handlerMethod | |
| mapping | back to summary |
|---|---|
| private final T mapping | |
| Match | back to summary |
|---|---|
| pack-priv Match(T mapping, HandlerMethod handlerMethod) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Field and Description |
|---|---|
| private final Comparator |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | compare(AbstractMethodMessageHandler.
the first object to be compared. match1,the second object to be compared. match2Implements java. Compares its two arguments for order. |
| comparator | back to summary |
|---|---|
| private final Comparator<T> comparator | |
| MatchComparator | back to summary |
|---|---|
| pack-priv MatchComparator(Comparator<T> comparator) | |
| compare | back to summary |
|---|---|
| public int compare(AbstractMethodMessageHandler. Implements java. Doc from java. Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The implementor must ensure that
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |