public final class IntegrationRequestMappingHandlerMapping
extends org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
implements org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>, org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor
HandlerMapping
implementation that
detects and registers RequestMappingInfo
s for
HttpRequestHandlingEndpointSupport
from a Spring Integration HTTP configuration
of <inbound-channel-adapter/>
and <inbound-gateway/>
elements.
This class is automatically configured as a bean in the application context during the
parsing phase of the <inbound-channel-adapter/>
and <inbound-gateway/>
elements, if there is none registered, yet. However it can be configured as a regular
bean with appropriate configuration for RequestMappingHandlerMapping
.
It is recommended to have only one similar bean in the application context using the 'id'
HttpContextUtils.HANDLER_MAPPING_BEAN_NAME
.
In most cases, Spring MVC offers to configure Request Mapping via
org.springframework.stereotype.Controller
and
RequestMapping
.
That's why Spring MVC's Handler Mapping infrastructure relies on
HandlerMethod
, as different methods at the same
org.springframework.stereotype.Controller
user-class may have their own
RequestMapping
.
On the other side, all Spring Integration HTTP Inbound Endpoints are configured on
the basis of the same BaseHttpInboundEndpoint
class and there is no
single RequestMappingInfo
configuration without
HandlerMethod
in Spring MVC.
Accordingly IntegrationRequestMappingHandlerMapping
is a
HandlerMapping
compromise implementation between method-level annotations and component-level
(e.g. Spring Integration XML) configurations.
Starting with version 5.1, this class implements DestructionAwareBeanPostProcessor
to
register HTTP endpoints at runtime for dynamically declared beans, e.g. via
IntegrationFlowContext
, and unregister
them during the BaseHttpInboundEndpoint
destruction.
RequestMapping
,
RequestMappingHandlerMapping
Constructor and Description |
---|
IntegrationRequestMappingHandlerMapping() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected void |
detectHandlerMethods(java.lang.Object handler) |
protected org.springframework.web.cors.CorsConfiguration |
getCorsConfiguration(java.lang.Object handler,
javax.servlet.http.HttpServletRequest request) |
protected org.springframework.web.servlet.HandlerExecutionChain |
getHandlerExecutionChain(java.lang.Object handler,
javax.servlet.http.HttpServletRequest request) |
protected org.springframework.web.cors.CorsConfiguration |
initCorsConfiguration(java.lang.Object handler,
java.lang.reflect.Method method,
org.springframework.web.servlet.mvc.method.RequestMappingInfo mappingInfo) |
protected boolean |
isHandler(java.lang.Class<?> beanType) |
void |
onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
HttpRequestHandlingEndpointSupport s may depend on auto-created
requestChannel s, so MVC Handlers detection should be postponed
as late as possible. |
void |
postProcessBeforeDestruction(java.lang.Object bean,
java.lang.String beanName) |
java.lang.Object |
postProcessBeforeInitialization(java.lang.Object bean,
java.lang.String beanName) |
boolean |
requiresDestruction(java.lang.Object bean) |
createRequestMappingInfo, getContentNegotiationManager, getCustomMethodCondition, getCustomTypeCondition, getFileExtensions, getMappingForMethod, getPathPrefixes, match, resolveEmbeddedValuesInPatterns, setContentNegotiationManager, setEmbeddedValueResolver, setPathPrefixes, setUseRegisteredSuffixPatternMatch, setUseSuffixPatternMatch, setUseTrailingSlashMatch, useRegisteredSuffixPatternMatch, useSuffixPatternMatch, useTrailingSlashMatch
getMappingComparator, getMappingPathPatterns, getMatchingMapping, handleMatch, handleNoMatch
createHandlerMethod, getCandidateBeanNames, getHandlerInternal, getHandlerMethods, getHandlerMethodsForMappingName, getNamingStrategy, handlerMethodsInitialized, initHandlerMethods, lookupHandlerMethod, processCandidateBean, registerHandlerMethod, registerMapping, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, unregisterMapping
adaptInterceptor, detectMappedInterceptors, extendInterceptors, formatMappingName, getAdaptedInterceptors, getCorsConfigurations, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getMappedInterceptors, getOrder, getPathMatcher, getUrlPathHelper, initApplicationContext, initInterceptors, setAlwaysUseFullPath, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public IntegrationRequestMappingHandlerMapping()
public java.lang.Object postProcessBeforeInitialization(java.lang.Object bean, java.lang.String beanName) throws org.springframework.beans.BeansException
postProcessBeforeInitialization
in interface org.springframework.beans.factory.config.BeanPostProcessor
org.springframework.beans.BeansException
public void postProcessBeforeDestruction(java.lang.Object bean, java.lang.String beanName) throws org.springframework.beans.BeansException
postProcessBeforeDestruction
in interface org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor
org.springframework.beans.BeansException
public boolean requiresDestruction(java.lang.Object bean)
requiresDestruction
in interface org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor
protected boolean isHandler(java.lang.Class<?> beanType)
isHandler
in class org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
protected org.springframework.web.servlet.HandlerExecutionChain getHandlerExecutionChain(java.lang.Object handler, javax.servlet.http.HttpServletRequest request)
getHandlerExecutionChain
in class org.springframework.web.servlet.handler.AbstractHandlerMapping
protected org.springframework.web.cors.CorsConfiguration getCorsConfiguration(java.lang.Object handler, javax.servlet.http.HttpServletRequest request)
getCorsConfiguration
in class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
protected void detectHandlerMethods(java.lang.Object handler)
detectHandlerMethods
in class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
protected org.springframework.web.cors.CorsConfiguration initCorsConfiguration(java.lang.Object handler, java.lang.reflect.Method method, org.springframework.web.servlet.mvc.method.RequestMappingInfo mappingInfo)
initCorsConfiguration
in class org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
in class org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
HttpRequestHandlingEndpointSupport
s may depend on auto-created
requestChannel
s, so MVC Handlers detection should be postponed
as late as possible.onApplicationEvent
in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
RequestMappingHandlerMapping.afterPropertiesSet()