class AnnotationDrivenBeanDefinitionParser extends java.lang.Object implements BeanDefinitionParser
BeanDefinitionParser
that provides the configuration for the
<annotation-driven/>
MVC namespace element.
This class registers the following HandlerMapping
s:
RequestMappingHandlerMapping
ordered at 0 for mapping requests to annotated controller methods.
BeanNameUrlHandlerMapping
ordered at 2 to map URL paths to controller bean names.
Note: Additional HandlerMappings may be registered
as a result of using the <view-controller>
or the
<resources>
MVC namespace elements.
This class registers the following HandlerAdapter
s:
RequestMappingHandlerAdapter
for processing requests with annotated controller methods.
HttpRequestHandlerAdapter
for processing requests with HttpRequestHandler
s.
SimpleControllerHandlerAdapter
for processing requests with interface-based Controller
s.
This class registers the following HandlerExceptionResolver
s:
ExceptionHandlerExceptionResolver
for handling exceptions
through @ExceptionHandler
methods.
ResponseStatusExceptionResolver
for exceptions annotated
with @ResponseStatus
.
DefaultHandlerExceptionResolver
for resolving known Spring
exception types
This class registers an AntPathMatcher
and a UrlPathHelper
to be used by:
RequestMappingHandlerMapping
,
HandlerMapping
for ViewControllers
HandlerMapping
for serving resources
path-matching
MVC namespace element.
Both the RequestMappingHandlerAdapter
and the
ExceptionHandlerExceptionResolver
are configured with instances of
the following by default:
ContentNegotiationManager
DefaultFormattingConversionService
LocalValidatorFactoryBean
if a JSR-303 implementation is available on the classpath
HttpMessageConverter
s depending on what 3rd party
libraries are available on the classpath.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
AnnotationDrivenBeanDefinitionParser.CompositeUriComponentsContributorFactoryBean
A FactoryBean for a CompositeUriComponentsContributor that obtains the
HandlerMethodArgumentResolver's configured in RequestMappingHandlerAdapter
after it is fully initialized.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONTENT_NEGOTIATION_MANAGER_BEAN_NAME |
private static boolean |
gsonPresent |
private static boolean |
jackson2Present |
private static boolean |
jackson2XmlPresent |
private static boolean |
javaxValidationPresent |
private static boolean |
jaxb2Present |
private static boolean |
romePresent |
Constructor and Description |
---|
AnnotationDrivenBeanDefinitionParser() |
Modifier and Type | Method and Description |
---|---|
protected void |
addResponseBodyAdvice(RootBeanDefinition beanDef) |
private void |
configurePathMatchingProperties(RootBeanDefinition handlerMappingDef,
org.w3c.dom.Element element,
ParserContext parserContext) |
private RootBeanDefinition |
createConverterDefinition(java.lang.Class<?> converterClass,
java.lang.Object source) |
private GenericBeanDefinition |
createObjectMapperFactoryDefinition(java.lang.Object source) |
private ManagedList<BeanReference> |
extractBeanRefSubElements(org.w3c.dom.Element parentElement,
ParserContext parserContext) |
private ManagedList<java.lang.Object> |
extractBeanSubElements(org.w3c.dom.Element parentElement,
ParserContext parserContext) |
private ManagedList<?> |
getArgumentResolvers(org.w3c.dom.Element element,
ParserContext parserContext) |
private RuntimeBeanReference |
getAsyncExecutor(org.w3c.dom.Element element) |
private java.lang.String |
getAsyncTimeout(org.w3c.dom.Element element) |
private ManagedList<?> |
getCallableInterceptors(org.w3c.dom.Element element,
java.lang.Object source,
ParserContext parserContext) |
private RuntimeBeanReference |
getContentNegotiationManager(org.w3c.dom.Element element,
java.lang.Object source,
ParserContext parserContext) |
private RuntimeBeanReference |
getConversionService(org.w3c.dom.Element element,
java.lang.Object source,
ParserContext parserContext) |
private java.util.Properties |
getDefaultMediaTypes() |
private ManagedList<?> |
getDeferredResultInterceptors(org.w3c.dom.Element element,
java.lang.Object source,
ParserContext parserContext) |
private RuntimeBeanReference |
getMessageCodesResolver(org.w3c.dom.Element element) |
private ManagedList<?> |
getMessageConverters(org.w3c.dom.Element element,
java.lang.Object source,
ParserContext parserContext) |
private ManagedList<?> |
getReturnValueHandlers(org.w3c.dom.Element element,
ParserContext parserContext) |
private RuntimeBeanReference |
getValidator(org.w3c.dom.Element element,
java.lang.Object source,
ParserContext parserContext) |
BeanDefinition |
parse(org.w3c.dom.Element element,
ParserContext parserContext)
Parse the specified
Element and register the resulting
BeanDefinition(s) with the
BeanDefinitionRegistry
embedded in the supplied ParserContext . |
private ManagedList<java.lang.Object> |
wrapLegacyResolvers(java.util.List<java.lang.Object> list,
ParserContext context) |
public static final java.lang.String CONTENT_NEGOTIATION_MANAGER_BEAN_NAME
private static final boolean javaxValidationPresent
private static boolean romePresent
private static final boolean jaxb2Present
private static final boolean jackson2Present
private static final boolean jackson2XmlPresent
private static final boolean gsonPresent
public BeanDefinition parse(org.w3c.dom.Element element, ParserContext parserContext)
BeanDefinitionParser
Element
and register the resulting
BeanDefinition(s)
with the
BeanDefinitionRegistry
embedded in the supplied ParserContext
.
Implementations must return the primary BeanDefinition
that results
from the parse if they will ever be used in a nested fashion (for example as
an inner tag in a <property/>
tag). Implementations may return
null
if they will not be used in a nested fashion.
parse
in interface BeanDefinitionParser
element
- the element that is to be parsed into one or more BeanDefinitions
parserContext
- the object encapsulating the current state of the parsing process;
provides access to a BeanDefinitionRegistry
BeanDefinition
protected void addResponseBodyAdvice(RootBeanDefinition beanDef)
private RuntimeBeanReference getConversionService(org.w3c.dom.Element element, java.lang.Object source, ParserContext parserContext)
private RuntimeBeanReference getValidator(org.w3c.dom.Element element, java.lang.Object source, ParserContext parserContext)
private RuntimeBeanReference getContentNegotiationManager(org.w3c.dom.Element element, java.lang.Object source, ParserContext parserContext)
private void configurePathMatchingProperties(RootBeanDefinition handlerMappingDef, org.w3c.dom.Element element, ParserContext parserContext)
private java.util.Properties getDefaultMediaTypes()
private RuntimeBeanReference getMessageCodesResolver(org.w3c.dom.Element element)
private java.lang.String getAsyncTimeout(org.w3c.dom.Element element)
private RuntimeBeanReference getAsyncExecutor(org.w3c.dom.Element element)
private ManagedList<?> getCallableInterceptors(org.w3c.dom.Element element, java.lang.Object source, ParserContext parserContext)
private ManagedList<?> getDeferredResultInterceptors(org.w3c.dom.Element element, java.lang.Object source, ParserContext parserContext)
private ManagedList<?> getArgumentResolvers(org.w3c.dom.Element element, ParserContext parserContext)
private ManagedList<java.lang.Object> wrapLegacyResolvers(java.util.List<java.lang.Object> list, ParserContext context)
private ManagedList<?> getReturnValueHandlers(org.w3c.dom.Element element, ParserContext parserContext)
private ManagedList<?> getMessageConverters(org.w3c.dom.Element element, java.lang.Object source, ParserContext parserContext)
private GenericBeanDefinition createObjectMapperFactoryDefinition(java.lang.Object source)
private RootBeanDefinition createConverterDefinition(java.lang.Class<?> converterClass, java.lang.Object source)
private ManagedList<java.lang.Object> extractBeanSubElements(org.w3c.dom.Element parentElement, ParserContext parserContext)
private ManagedList<BeanReference> extractBeanRefSubElements(org.w3c.dom.Element parentElement, ParserContext parserContext)