public final class IntegrationRequestMappingHandlerMapping extends RequestMappingHandlerMapping implements ApplicationListener<ContextRefreshedEvent>, DestructionAwareBeanPostProcessor
<inbound-channel-adapter/>
および <inbound-gateway/>
要素の Spring Integration HTTP 構成から HttpRequestHandlingEndpointSupport
の RequestMappingInfo
を検出および登録する HandlerMapping
実装。 このクラスは、<inbound-channel-adapter/>
および <inbound-gateway/>
要素の解析フェーズ中に、まだ何も登録されていない場合、アプリケーションコンテキストで Bean として自動的に構成されます。ただし、RequestMappingHandlerMapping
の適切な構成を使用して、通常の Bean として構成できます。'id' HttpContextUtils.HANDLER_MAPPING_BEAN_NAME
を使用して、アプリケーションコンテキスト内に同様の Bean を 1 つだけ持つことをお勧めします。
ほとんどの場合、Spring MVC は org.springframework.stereotype.Controller
および RequestMapping
を介してリクエストマッピングを構成することを提案します。これが、Spring MVC のハンドラーマッピングインフラストラクチャが HandlerMethod
に依存している理由です。同じ org.springframework.stereotype.Controller
ユーザークラスの異なるメソッドが独自の RequestMapping
を持つ場合があるためです。一方、すべての Spring Integration HTTP 受信 エンドポイントは、同じ BaseHttpInboundEndpoint
クラスに基づいて構成されており、Spring MVC に HandlerMethod
がない単一の RequestMappingInfo
構成はありません。IntegrationRequestMappingHandlerMapping
は、メソッドレベルのアノテーションとコンポーネントレベル (Spring Integration XML など) の構成の間の HandlerMapping
妥協の実装です。
バージョン 5.1 以降、このクラスは DestructionAwareBeanPostProcessor
を実装して、動的に宣言された Bean の実行時に HTTP エンドポイントを登録します。IntegrationFlowContext
を使用して、BaseHttpInboundEndpoint
の破棄中に登録を解除します。
このクラスは Spring MVC RequestMappingHandlerMapping
クラスを継承し、そのロジックのほとんど、特に RequestMappingInfoHandlerMapping.handleNoMatch(java.util.Set, String, HttpServletRequest)
を継承します。これは、何らかの理由でマッピングが一致しない場合に HTTP レスポンスに対して特定の 4xx
エラーをスローし、アプリケーションコンテキスト内の残りのマッピングハンドラーへの呼び出しを防ぎます。このため、Spring Integration と Spring MVC の両方のリクエストマッピングに同じパスを設定することはサポートされていません(たとえば、一方に `POST`、もう一方に `GET`)。MVC マッピングは見つかりません。
RequestMapping
, RequestMappingHandlerMapping
logger
BEST_MATCHING_HANDLER_ATTRIBUTE, BEST_MATCHING_PATTERN_ATTRIBUTE, INTROSPECT_TYPE_LEVEL_MAPPING, LOOKUP_PATH, MATRIX_VARIABLES_ATTRIBUTE, PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, URI_TEMPLATE_VARIABLES_ATTRIBUTE
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
コンストラクターと説明 |
---|
IntegrationRequestMappingHandlerMapping() |
修飾子と型 | メソッドと説明 |
---|---|
void | afterPropertiesSet() |
protected void | detectHandlerMethods(ObjectSE handlerArg) |
protected CorsConfiguration | getCorsConfiguration(ObjectSE handler, HttpServletRequestSE request) |
protected HandlerExecutionChain | getHandlerExecutionChain(ObjectSE handlerArg, HttpServletRequestSE request) |
protected CorsConfiguration | initCorsConfiguration(ObjectSE handler, MethodSE method, RequestMappingInfo mappingInfo) |
protected boolean | isHandler(ClassSE<?> beanType) |
void | onApplicationEvent(ContextRefreshedEvent event) HttpRequestHandlingEndpointSupport は自動作成された requestChannel に依存する可能性があるため、MVC ハンドラーの検出は可能な限り遅く延期する必要があります。 |
void | postProcessBeforeDestruction(ObjectSE bean, StringSE beanName) |
ObjectSE | postProcessBeforeInitialization(ObjectSE bean, StringSE beanName) |
boolean | requiresDestruction(ObjectSE bean) |
createRequestMappingInfo, getContentNegotiationManager, getCustomMethodCondition, getCustomTypeCondition, getFileExtensions, getMappingForMethod, getPathPrefixes, match, registerHandlerMethod, registerMapping, resolveEmbeddedValuesInPatterns, setContentNegotiationManager, setEmbeddedValueResolver, setPathPrefixes, setUseRegisteredSuffixPatternMatch, setUseSuffixPatternMatch, setUseTrailingSlashMatch, useRegisteredSuffixPatternMatch, useSuffixPatternMatch, useTrailingSlashMatch
getDirectPaths, getHandlerInternal, getMappingComparator, getMappingPathPatterns, getMatchingMapping, handleMatch, handleNoMatch
createHandlerMethod, getCandidateBeanNames, getHandlerMethods, getHandlerMethodsForMappingName, getNamingStrategy, handlerMethodsInitialized, hasCorsConfigurationSource, initHandlerMethods, lookupHandlerMethod, processCandidateBean, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, unregisterMapping
adaptInterceptor, detectMappedInterceptors, extendInterceptors, formatMappingName, getAdaptedInterceptors, getCorsConfigurationSource, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getMappedInterceptors, getOrder, getPathMatcher, getPatternParser, getUrlPathHelper, initApplicationContext, initInterceptors, initLookupPath, setAlwaysUseFullPath, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setPatternParser, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper, usesPathPatterns
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContext
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
forPayload
postProcessAfterInitialization
getPatternParser
getHandler, usesPathPatterns
public ObjectSE postProcessBeforeInitialization(ObjectSE bean, StringSE beanName) throws BeansException
BeanPostProcessor
の postProcessBeforeInitialization
BeansException
public void postProcessBeforeDestruction(ObjectSE bean, StringSE beanName) throws BeansException
DestructionAwareBeanPostProcessor
の postProcessBeforeDestruction
BeansException
public boolean requiresDestruction(ObjectSE bean)
DestructionAwareBeanPostProcessor
の requiresDestruction
protected boolean isHandler(ClassSE<?> beanType)
RequestMappingHandlerMapping
の isHandler
protected HandlerExecutionChain getHandlerExecutionChain(ObjectSE handlerArg, HttpServletRequestSE request)
AbstractHandlerMapping
の getHandlerExecutionChain
protected CorsConfiguration getCorsConfiguration(ObjectSE handler, HttpServletRequestSE request)
AbstractHandlerMethodMapping<RequestMappingInfo>
の getCorsConfiguration
protected void detectHandlerMethods(ObjectSE handlerArg)
AbstractHandlerMethodMapping<RequestMappingInfo>
の detectHandlerMethods
protected CorsConfiguration initCorsConfiguration(ObjectSE handler, MethodSE method, RequestMappingInfo mappingInfo)
RequestMappingHandlerMapping
の initCorsConfiguration
public void onApplicationEvent(ContextRefreshedEvent event)
HttpRequestHandlingEndpointSupport
は自動作成された requestChannel
に依存する可能性があるため、MVC ハンドラーの検出は可能な限り遅く延期する必要があります。public void afterPropertiesSet()
InitializingBean
の afterPropertiesSet
RequestMappingHandlerMapping
の afterPropertiesSet