Class AbstractDetectingUrlHandlerMapping
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.handler.AbstractHandlerMapping
org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping
- All Implemented Interfaces:
- Aware,- BeanNameAware,- ApplicationContextAware,- Ordered,- ServletContextAware,- MatchableHandlerMapping,- HandlerMapping
- Direct Known Subclasses:
- BeanNameUrlHandlerMapping
Abstract implementation of the 
HandlerMapping
 interface, detecting URL mappings for handler beans through introspection of all
 defined beans in the application context.- Since:
- 2.5
- Author:
- Juergen Hoeller
- See Also:
- 
Field SummaryFields inherited from class org.springframework.web.servlet.handler.AbstractHandlerMappingmappingsLoggerFields inherited from class org.springframework.context.support.ApplicationObjectSupportloggerFields inherited from interface org.springframework.web.servlet.HandlerMappingBEST_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_ATTRIBUTEFields inherited from interface org.springframework.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidRegister all handlers found in the current ApplicationContext.protected abstract String[]determineUrlsForHandler(String beanName) Determine the URLs for the given handler bean.voidCalls thedetectHandlers()method in addition to the superclass's initialization.voidsetDetectHandlersInAncestorContexts(boolean detectHandlersInAncestorContexts) Set whether to detect handler beans in ancestor ApplicationContexts.Methods inherited from class org.springframework.web.servlet.handler.AbstractUrlHandlerMappingbuildPathExposingHandler, exposePathWithinMapping, exposeUriTemplateVariables, getHandlerInternal, getHandlerMap, getPathPatternHandlerMap, getRootHandler, lookupHandler, lookupHandler, match, registerHandler, registerHandler, setLazyInitHandlers, setPatternParser, setRootHandler, supportsTypeLevelMappings, unregisterHandler, validateHandlerMethods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMappingadaptInterceptor, detectMappedInterceptors, extendInterceptors, formatMappingName, getAdaptedInterceptors, getCorsConfiguration, getCorsConfigurationSource, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getPatternParser, getUrlPathHelper, hasCorsConfigurationSource, initInterceptors, initLookupPath, setAlwaysUseFullPath, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper, usesPathPatternsMethods inherited from class org.springframework.web.context.support.WebApplicationObjectSupportgetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextMethods inherited from class org.springframework.context.support.ApplicationObjectSupportgetApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContextMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.servlet.HandlerMappinggetHandler, usesPathPatternsMethods inherited from interface org.springframework.web.servlet.handler.MatchableHandlerMappinggetPatternParser
- 
Constructor Details- 
AbstractDetectingUrlHandlerMappingpublic AbstractDetectingUrlHandlerMapping()
 
- 
- 
Method Details- 
setDetectHandlersInAncestorContextspublic void setDetectHandlersInAncestorContexts(boolean detectHandlersInAncestorContexts) Set whether to detect handler beans in ancestor ApplicationContexts.Default is "false": Only handler beans in the current ApplicationContext will be detected, i.e. only in the context that this HandlerMapping itself is defined in (typically the current DispatcherServlet's context). Switch this flag on to detect handler beans in ancestor contexts (typically the Spring root WebApplicationContext) as well. 
- 
initApplicationContextCalls thedetectHandlers()method in addition to the superclass's initialization.- Overrides:
- initApplicationContextin class- AbstractHandlerMapping
- Throws:
- ApplicationContextException- in case of initialization errors
- See Also:
 
- 
detectHandlersRegister all handlers found in the current ApplicationContext.The actual URL determination for a handler is up to the concrete determineUrlsForHandler(String)implementation. A bean for which no such URLs could be determined is simply not considered a handler.- Throws:
- BeansException- if the handler couldn't be registered
- See Also:
 
- 
determineUrlsForHandlerDetermine the URLs for the given handler bean.- Parameters:
- beanName- the name of the candidate bean
- Returns:
- the URLs determined for the bean, or an empty array if none
 
 
-