Top Description Inners Fields Constructors Methods
org.springframework.web.servlet.config

pack-priv Class AnnotationDrivenBeanDefinitionParser

extends Object
implements BeanDefinitionParser
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.xml.BeanDefinitionParser
Imports
java.util.List, .Properties, com.fasterxml.jackson.dataformat.cbor.CBORFactory, com.fasterxml.jackson.dataformat.smile.SmileFactory, org.w3c.dom.Element, org.springframework.beans.factory.FactoryBean, .InitializingBean, org.springframework.beans.factory.config.BeanDefinition, .BeanDefinitionHolder, .RuntimeBeanReference, org.springframework.beans.factory.parsing.BeanComponentDefinition, .CompositeComponentDefinition, org.springframework.beans.factory.support.GenericBeanDefinition, .ManagedList, .RootBeanDefinition, org.springframework.beans.factory.xml.BeanDefinitionParser, .ParserContext, .XmlReaderContext, org.springframework.core.convert.ConversionService, org.springframework.format.support.DefaultFormattingConversionService, .FormattingConversionServiceFactoryBean, org.springframework.http.MediaType, org.springframework.http.converter.ByteArrayHttpMessageConverter, .HttpMessageConverter, .ResourceHttpMessageConverter, .ResourceRegionHttpMessageConverter, .StringHttpMessageConverter, org.springframework.http.converter.cbor.MappingJackson2CborHttpMessageConverter, org.springframework.http.converter.feed.AtomFeedHttpMessageConverter, .RssChannelHttpMessageConverter, org.springframework.http.converter.json.GsonHttpMessageConverter, .Jackson2ObjectMapperFactoryBean, .MappingJackson2HttpMessageConverter, org.springframework.http.converter.smile.MappingJackson2SmileHttpMessageConverter, org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter, org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter, .MappingJackson2XmlHttpMessageConverter, org.springframework.lang.Nullable, org.springframework.util.Assert, .ClassUtils, org.springframework.util.xml.DomUtils, org.springframework.web.HttpRequestHandler, org.springframework.web.accept.ContentNegotiationManager, .ContentNegotiationManagerFactoryBean, org.springframework.web.bind.support.ConfigurableWebBindingInitializer, .WebArgumentResolver, org.springframework.web.method.support.CompositeUriComponentsContributor, org.springframework.web.servlet.HandlerAdapter, .HandlerExceptionResolver, .HandlerMapping, org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping, .ConversionServiceExposingInterceptor, .MappedInterceptor, org.springframework.web.servlet.mvc.Controller, .HttpRequestHandlerAdapter, .SimpleControllerHandlerAdapter, org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver, org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver, .JsonViewRequestBodyAdvice, .JsonViewResponseBodyAdvice, .MvcUriComponentsBuilder, .RequestMappingHandlerAdapter, .RequestMappingHandlerMapping, .ServletWebArgumentResolverAdapter, org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver

A BeanDefinitionParser that provides the configuration for the <annotation-driven/> MVC namespace element.

This class registers the following HandlerMappings:

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 HandlerAdapters:

This class registers the following HandlerExceptionResolvers:

This class registers an org.springframework.util.AntPathMatcher and a org.springframework.web.util.UrlPathHelper to be used by:

Note that those beans can be configured by using the path-matching MVC namespace element.

Both the RequestMappingHandlerAdapter and the ExceptionHandlerExceptionResolver are configured with instances of the following by default:

Authors
Keith Donald, Juergen Hoeller, Arjen Poutsma, Rossen Stoyanchev, Brian Clozel, Agim Emruli
Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
AnnotationDrivenBeanDefinitionParser.CompositeUriComponentsContributorFactoryBean

A FactoryBean for a CompositeUriComponentsContributor that obtains the HandlerMethodArgumentResolver's configured in RequestMappingHandlerAdapter after it is fully initialized.

Field Summary

Modifier and TypeField and Description
public static final String
private static final boolean
public static final String
public static final String
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private static final boolean
private static final boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
private void
private RootBeanDefinition
createConverterDefinition(Class<?> converterClass, Object source)

private GenericBeanDefinition
private ManagedList<Object>
private ManagedList<?>
private RuntimeBeanReference
private String
private RuntimeBeanReference
private RuntimeBeanReference
private Properties
private ManagedList<?>
getInterceptors(Element element, Object source, ParserContext context, String interceptorElementName)

private RuntimeBeanReference
private ManagedList<?>
private ManagedList<?>
private RuntimeBeanReference
getValidator(Element element, Object source, ParserContext context)

public BeanDefinition
parse(Element
the element that is to be parsed into one or more BeanDefinitions
element
,
ParserContext
the object encapsulating the current state of the parsing process; provides access to a org.springframework.beans.factory.support.BeanDefinitionRegistry
context
)

Implements org.springframework.beans.factory.xml.BeanDefinitionParser.parse.

Parse the specified Element and register the resulting BeanDefinition(s) with the BeanDefinitionRegistry embedded in the supplied ParserContext.

private ManagedList<Object>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CONTENT_NEGOTIATION_MANAGER_BEAN_NAMEback to summary
public static final String CONTENT_NEGOTIATION_MANAGER_BEAN_NAME
gsonPresentback to summary
private static final boolean gsonPresent
HANDLER_ADAPTER_BEAN_NAMEback to summary
public static final String HANDLER_ADAPTER_BEAN_NAME
HANDLER_MAPPING_BEAN_NAMEback to summary
public static final String HANDLER_MAPPING_BEAN_NAME
jackson2CborPresentback to summary
private static final boolean jackson2CborPresent
jackson2Presentback to summary
private static final boolean jackson2Present
jackson2SmilePresentback to summary
private static final boolean jackson2SmilePresent
jackson2XmlPresentback to summary
private static final boolean jackson2XmlPresent
javaxValidationPresentback to summary
private static final boolean javaxValidationPresent
jaxb2Presentback to summary
private static final boolean jaxb2Present
romePresentback to summary
private static final boolean romePresent

Constructor Detail

AnnotationDrivenBeanDefinitionParserback to summary
pack-priv AnnotationDrivenBeanDefinitionParser()

Method Detail

addRequestBodyAdviceback to summary
protected void addRequestBodyAdvice(RootBeanDefinition beanDef)
addResponseBodyAdviceback to summary
protected void addResponseBodyAdvice(RootBeanDefinition beanDef)
configurePathMatchingPropertiesback to summary
private void configurePathMatchingProperties(RootBeanDefinition handlerMappingDef, Element element, ParserContext context)
createConverterDefinitionback to summary
private RootBeanDefinition createConverterDefinition(Class<?> converterClass, Object source)
createObjectMapperFactoryDefinitionback to summary
private GenericBeanDefinition createObjectMapperFactoryDefinition(Object source)
extractBeanSubElementsback to summary
private ManagedList<Object> extractBeanSubElements(Element parentElement, ParserContext context)
getArgumentResolversback to summary
private ManagedList<?> getArgumentResolvers(Element element, ParserContext context)
Annotations
@Nullable
getAsyncExecutorback to summary
private RuntimeBeanReference getAsyncExecutor(Element element)
Annotations
@Nullable
getAsyncTimeoutback to summary
private String getAsyncTimeout(Element element)
Annotations
@Nullable
getContentNegotiationManagerback to summary
private RuntimeBeanReference getContentNegotiationManager(Element element, Object source, ParserContext context)
getConversionServiceback to summary
private RuntimeBeanReference getConversionService(Element element, Object source, ParserContext context)
getDefaultMediaTypesback to summary
private Properties getDefaultMediaTypes()
getInterceptorsback to summary
private ManagedList<?> getInterceptors(Element element, Object source, ParserContext context, String interceptorElementName)
getMessageCodesResolverback to summary
private RuntimeBeanReference getMessageCodesResolver(Element element)
Annotations
@Nullable
getMessageConvertersback to summary
private ManagedList<?> getMessageConverters(Element element, Object source, ParserContext context)
getReturnValueHandlersback to summary
private ManagedList<?> getReturnValueHandlers(Element element, ParserContext context)
Annotations
@Nullable
getValidatorback to summary
private RuntimeBeanReference getValidator(Element element, Object source, ParserContext context)
Annotations
@Nullable
parseback to summary
public BeanDefinition parse(Element element, ParserContext context)

Implements org.springframework.beans.factory.xml.BeanDefinitionParser.parse.

Doc from org.springframework.beans.factory.xml.BeanDefinitionParser.parse.

Parse the specified 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.

Parameters
element:Element

the element that is to be parsed into one or more BeanDefinitions

context:ParserContext

the object encapsulating the current state of the parsing process; provides access to a org.springframework.beans.factory.support.BeanDefinitionRegistry

Returns:BeanDefinition

the primary BeanDefinition

Annotations
@Override
@Nullable
wrapLegacyResolversback to summary
private ManagedList<Object> wrapLegacyResolvers(List<Object> list, ParserContext context)
org.springframework.web.servlet.config back to summary

pack-priv Class AnnotationDrivenBeanDefinitionParser.CompositeUriComponentsContributorFactoryBean

extends Object
implements FactoryBean<CompositeUriComponentsContributor>, InitializingBean
Class Inheritance
  • java.lang.Object
  • org.springframework.web.servlet.config.AnnotationDrivenBeanDefinitionParser.CompositeUriComponentsContributorFactoryBean
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.FactoryBean

A FactoryBean for a CompositeUriComponentsContributor that obtains the HandlerMethodArgumentResolver's configured in RequestMappingHandlerAdapter after it is fully initialized.

Field Summary

Modifier and TypeField and Description
private ConversionService
private RequestMappingHandlerAdapter
private CompositeUriComponentsContributor

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

public CompositeUriComponentsContributor
getObject()

Implements org.springframework.beans.factory.FactoryBean.getObject.

Return an instance (possibly shared or independent) of the object managed by this factory.

public Class<?>
getObjectType()

Implements org.springframework.beans.factory.FactoryBean.getObjectType.

Return the type of object that this FactoryBean creates, or null if not known in advance.

public boolean
isSingleton()

Overrides default org.springframework.beans.factory.FactoryBean.isSingleton.

Is the object managed by this factory a singleton?

public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

conversionServiceback to summary
private ConversionService conversionService
Annotations
@Nullable
handlerAdapterback to summary
private RequestMappingHandlerAdapter handlerAdapter
Annotations
@Nullable
uriComponentsContributorback to summary
private CompositeUriComponentsContributor uriComponentsContributor
Annotations
@Nullable

Constructor Detail

CompositeUriComponentsContributorFactoryBeanback to summary
pack-priv CompositeUriComponentsContributorFactoryBean()

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

Annotations
@Override
getObjectback to summary
public CompositeUriComponentsContributor getObject()

Implements org.springframework.beans.factory.FactoryBean.getObject.

Doc from org.springframework.beans.factory.FactoryBean.getObject.

Return an instance (possibly shared or independent) of the object managed by this factory.

As with a BeanFactory, this allows support for both the Singleton and Prototype design pattern.

If this FactoryBean is not fully initialized yet at the time of the call (for example because it is involved in a circular reference), throw a corresponding FactoryBeanNotInitializedException.

As of Spring 2.0, FactoryBeans are allowed to return null objects. The factory will consider this as normal value to be used; it will not throw a FactoryBeanNotInitializedException in this case anymore. FactoryBean implementations are encouraged to throw FactoryBeanNotInitializedException themselves now, as appropriate.

Returns:CompositeUriComponentsContributor

an instance of the bean (can be null)

Annotations
@Override
@Nullable
getObjectTypeback to summary
public Class<?> getObjectType()

Implements org.springframework.beans.factory.FactoryBean.getObjectType.

Doc from org.springframework.beans.factory.FactoryBean.getObjectType.

Return the type of object that this FactoryBean creates, or null if not known in advance.

This allows one to check for specific types of beans without instantiating objects, for example on autowiring.

In the case of implementations that are creating a singleton object, this method should try to avoid singleton creation as far as possible; it should rather estimate the type in advance. For prototypes, returning a meaningful type here is advisable too.

This method can be called before this FactoryBean has been fully initialized. It must not rely on state created during initialization; of course, it can still use such state if available.

Note

Autowiring will simply ignore FactoryBeans that return null here. Therefore, it is highly recommended to implement this method properly, using the current state of the FactoryBean.

Returns:Class<?>

the type of object that this FactoryBean creates, or null if not known at the time of the call

Annotations
@Override
isSingletonback to summary
public boolean isSingleton()

Overrides default org.springframework.beans.factory.FactoryBean.isSingleton.

Doc from org.springframework.beans.factory.FactoryBean.isSingleton.

Is the object managed by this factory a singleton? That is, will getObject() always return the same object (a reference that can be cached)?

Note

If a FactoryBean indicates to hold a singleton object, the object returned from getObject() might get cached by the owning BeanFactory. Hence, do not return true unless the FactoryBean always exposes the same reference.

The singleton status of the FactoryBean itself will generally be provided by the owning BeanFactory; usually, it has to be defined as singleton there.

Note

This method returning false does not necessarily indicate that returned objects are independent instances. An implementation of the extended SmartFactoryBean interface may explicitly indicate independent instances through its SmartFactoryBean#isPrototype() method. Plain FactoryBean implementations which do not implement this extended interface are simply assumed to always return independent instances if the isSingleton() implementation returns false.

The default implementation returns true, since a FactoryBean typically manages a singleton instance.

Returns:boolean

whether the exposed object is a singleton

Annotations
@Override
setConversionServiceback to summary
public void setConversionService(ConversionService conversionService)
setHandlerAdapterback to summary
public void setHandlerAdapter(RequestMappingHandlerAdapter handlerAdapter)