|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.context.config.AbstractFeatureSpecification
org.springframework.web.servlet.config.MvcAnnotationDriven
public final class MvcAnnotationDriven
Specifies the Spring MVC "annotation-driven" container feature. The feature provides the following fine-grained configuration:
DefaultAnnotationHandlerMapping
bean for mapping HTTP Servlet Requests
to @Controller
methods using @RequestMapping
annotations.
AnnotationMethodHandlerAdapter
bean for invoking annotated
@Controller
methods.
HandlerExceptionResolver
beans for invoking @ExceptionHandler
controller methods and for mapping Spring exception to HTTP status codes.
The HandlerAdapter
is further configured with the following, which apply
globally (across controllers invoked though the AnnotationMethodHandlerAdapter
):
ConversionService
- a custom instance can be provided via
conversionService(ConversionService)
. Otherwise it defaults to a fresh
ConversionService
instance created by the default
FormattingConversionServiceFactoryBean
.
Validator
- a custom instance can be provided via
validator(Validator)
. Otherwise it defaults to a fresh Validator
instance created by the default LocalValidatorFactoryBean
assuming
JSR-303 API is present on the classpath.
HttpMessageConverter
beans including the Jaxb2RootElementHttpMessageConverter
assuming JAXB2 is present on the
classpath, the MappingJacksonHttpMessageConverter
assuming Jackson
is present on the classpath, and the AtomFeedHttpMessageConverter
and the
RssChannelHttpMessageConverter
converters assuming Rome is present on
the classpath.
WebArgumentResolver
beans to use for resolving
custom arguments to handler methods. These are typically implemented to detect
special parameter types, resolving well-known argument values for them.
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 |
---|
public MvcAnnotationDriven()
Method Detail |
---|
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.
conversionService
- the ConversionService instance to usepublic 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.
conversionService
- the ConversionService bean namepublic MvcAnnotationDriven messageConverters(HttpMessageConverter<?>... converters)
shouldRegisterDefaultMessageConverters(boolean)
if
default registrations are to be turned off altogether.
converters
- the message converterspublic MvcAnnotationDriven shouldRegisterDefaultMessageConverters(boolean shouldRegister)
messageConverters(HttpMessageConverter...)
shouldRegister
- true will result in registration of defaults.public MvcAnnotationDriven argumentResolvers(WebArgumentResolver... resolvers)
public MvcAnnotationDriven validator(Validator validator)
If not specified, JSR-303 validation will be installed if a JSR-303 provider is present on the classpath.
validator
- the Validator bean instancepublic MvcAnnotationDriven validator(String validator)
validator(Validator)
allowing you to
provide a bean name rather than a bean instance.
validator
- the Validator bean namepublic MvcAnnotationDriven messageCodesResolver(MessageCodesResolver messageCodesResolver)
messageCodesResolver
- the MessageCodesResolver bean instancepublic MvcAnnotationDriven messageCodesResolver(String messageCodesResolver)
messageCodesResolver(MessageCodesResolver)
allowing you to provide
a bean name rather than a bean instance.
messageCodesResolver
- the MessageCodesResolver bean nameprotected void doValidate(ProblemCollector problems)
doValidate
in class AbstractFeatureSpecification
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |