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
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 | Field and Description |
---|---|
private static boolean |
jackson2Present |
private static boolean |
jacksonPresent |
private static boolean |
javaxValidationPresent |
private static boolean |
jaxb2Present |
private static boolean |
romePresent |
Constructor and Description |
---|
AnnotationDrivenBeanDefinitionParser() |
Modifier and Type | Method and Description |
---|---|
private RootBeanDefinition |
createConverterDefinition(java.lang.Class<? extends HttpMessageConverter> converterClass,
java.lang.Object source) |
private ManagedList<BeanDefinitionHolder> |
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<BeanDefinitionHolder> |
wrapWebArgumentResolverBeanDefs(java.util.List<BeanDefinitionHolder> beanDefs,
ParserContext parserContext) |
private static final boolean javaxValidationPresent
private static final boolean jaxb2Present
private static final boolean jackson2Present
private static final boolean jacksonPresent
private static boolean romePresent
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
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 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<?> getReturnValueHandlers(org.w3c.dom.Element element, ParserContext parserContext)
private ManagedList<?> getMessageConverters(org.w3c.dom.Element element, java.lang.Object source, ParserContext parserContext)
private RootBeanDefinition createConverterDefinition(java.lang.Class<? extends HttpMessageConverter> converterClass, java.lang.Object source)
private ManagedList<BeanDefinitionHolder> extractBeanSubElements(org.w3c.dom.Element parentElement, ParserContext parserContext)
private ManagedList<BeanDefinitionHolder> wrapWebArgumentResolverBeanDefs(java.util.List<BeanDefinitionHolder> beanDefs, ParserContext parserContext)