org.springframework.web.servlet.config
Class MvcAnnotationDriven

java.lang.Object
  extended by org.springframework.context.config.AbstractFeatureSpecification
      extended by org.springframework.web.servlet.config.MvcAnnotationDriven
All Implemented Interfaces:
FeatureSpecification, SourceAwareSpecification

public final class MvcAnnotationDriven
extends AbstractFeatureSpecification

Specifies the Spring MVC "annotation-driven" container feature. The feature provides the following fine-grained configuration:

The HandlerAdapter is further configured with the following, which apply globally (across controllers invoked though the AnnotationMethodHandlerAdapter):

Since:
3.1
Author:
Rossen Stoyanchev

Field Summary
 
Fields inherited from class org.springframework.context.config.AbstractFeatureSpecification
executorType
 
Constructor Summary
MvcAnnotationDriven()
          Creates an MvcAnnotationDriven specification.
 
Method Summary
 MvcAnnotationDriven argumentResolvers(WebArgumentResolver... resolvers)
           
 MvcAnnotationDriven conversionService(ConversionService conversionService)
           The ConversionService bean instance to use for type conversion during field binding.
 MvcAnnotationDriven conversionService(String conversionService)
           The ConversionService to use for type conversion during field binding.
protected  void doValidate(ProblemCollector problems)
           
 MvcAnnotationDriven messageCodesResolver(MessageCodesResolver messageCodesResolver)
          The MessageCodesResolver to use to build message codes from data binding and validation error codes.
 MvcAnnotationDriven messageCodesResolver(String messageCodesResolver)
          The MessageCodesResolver to use to build message codes from data binding and validation error codes.
 MvcAnnotationDriven messageConverters(HttpMessageConverter<?>... converters)
          The HttpMessageConverter types to use for converting @RequestBody method parameters and @ResponseBody method return values.
 MvcAnnotationDriven shouldRegisterDefaultMessageConverters(boolean shouldRegister)
          Indicates whether or not default HttpMessageConverter registrations should be added in addition to the ones provided via messageConverters(HttpMessageConverter...)
 MvcAnnotationDriven validator(String validator)
          The Validator bean instance to use to validate Controller model objects.
 MvcAnnotationDriven validator(Validator validator)
          The Validator bean instance to use to validate Controller model objects.
 
Methods inherited from class org.springframework.context.config.AbstractFeatureSpecification
execute, source, source, sourceName, sourceName, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MvcAnnotationDriven

public MvcAnnotationDriven()
Creates an MvcAnnotationDriven specification.

Method Detail

conversionService

public MvcAnnotationDriven conversionService(ConversionService conversionService)

The ConversionService bean instance to use for type conversion during field binding. This is not required input. It only needs to be provided explicitly if custom converters or formatters need to be configured.

If not provided, a default FormattingConversionService is registered that contains converters to/from standard JDK types. In addition, full support for date/time formatting will be installed if the Joda Time library is present on the classpath.

Parameters:
conversionService - the ConversionService instance to use

conversionService

public MvcAnnotationDriven conversionService(String conversionService)

The ConversionService to use for type conversion during field binding. This is an alternative to conversionService(ConversionService) allowing you to provide a bean name rather than a bean instance.

Parameters:
conversionService - the ConversionService bean name

messageConverters

public MvcAnnotationDriven messageConverters(HttpMessageConverter<?>... converters)
The HttpMessageConverter types to use for converting @RequestBody method parameters and @ResponseBody method return values. HttpMessageConverter registrations provided here will take precedence over HttpMessageConverter types registered by default. Also see shouldRegisterDefaultMessageConverters(boolean) if default registrations are to be turned off altogether.

Parameters:
converters - the message converters

shouldRegisterDefaultMessageConverters

public MvcAnnotationDriven shouldRegisterDefaultMessageConverters(boolean shouldRegister)
Indicates whether or not default HttpMessageConverter registrations should be added in addition to the ones provided via messageConverters(HttpMessageConverter...)

Parameters:
shouldRegister - true will result in registration of defaults.

argumentResolvers

public MvcAnnotationDriven argumentResolvers(WebArgumentResolver... resolvers)

validator

public MvcAnnotationDriven validator(Validator validator)
The Validator bean instance to use to validate Controller model objects. This is not required input. It only needs to be specified explicitly if a custom Validator needs to be configured.

If not specified, JSR-303 validation will be installed if a JSR-303 provider is present on the classpath.

Parameters:
validator - the Validator bean instance

validator

public MvcAnnotationDriven validator(String validator)
The Validator bean instance to use to validate Controller model objects. This is an alternative to validator(Validator) allowing you to provide a bean name rather than a bean instance.

Parameters:
validator - the Validator bean name

messageCodesResolver

public MvcAnnotationDriven messageCodesResolver(MessageCodesResolver messageCodesResolver)
The MessageCodesResolver to use to build message codes from data binding and validation error codes. This is not required input. If not specified the DefaultMessageCodesResolver is used.

Parameters:
messageCodesResolver - the MessageCodesResolver bean instance

messageCodesResolver

public MvcAnnotationDriven messageCodesResolver(String messageCodesResolver)
The MessageCodesResolver to use to build message codes from data binding and validation error codes. This is an alternative to messageCodesResolver(MessageCodesResolver) allowing you to provide a bean name rather than a bean instance.

Parameters:
messageCodesResolver - the MessageCodesResolver bean name

doValidate

protected void doValidate(ProblemCollector problems)
Specified by:
doValidate in class AbstractFeatureSpecification