@Configuration public class WebReactiveConfiguration extends Object implements ApplicationContextAware
Import directly or extend and override protected methods to customize.
Constructor and Description |
---|
WebReactiveConfiguration() |
Modifier and Type | Method and Description |
---|---|
protected void |
addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers)
Provide custom argument resolvers without overriding the built-in ones.
|
protected void |
addDefaultHttpMessageReaders(List<HttpMessageReader<?>> readers)
Adds default converters that sub-classes can call from
configureMessageReaders(List) . |
protected void |
addDefaultHttpMessageWriters(List<HttpMessageWriter<?>> writers)
Adds default converters that sub-classes can call from
configureMessageWriters(List) . |
protected void |
addFormatters(FormatterRegistry registry)
|
protected void |
addResourceHandlers(ResourceHandlerRegistry registry)
Override this method to add resource handlers for serving static resources.
|
protected void |
configureMessageReaders(List<HttpMessageReader<?>> messageReaders)
Override to configure the message readers to use for decoding
controller method arguments.
|
protected void |
configureMessageWriters(List<HttpMessageWriter<?>> messageWriters)
Override to configure the message writers to use for encoding
return values.
|
void |
configurePathMatching(PathMatchConfigurer configurer)
Override to configure path matching options.
|
protected void |
configureRequestedContentTypeResolver(RequestedContentTypeResolverBuilder builder)
Override to configure how the requested content type is resolved.
|
protected void |
configureViewResolvers(ViewResolverRegistry registry)
Override this to configure view resolution.
|
protected RequestMappingHandlerAdapter |
createRequestMappingHandlerAdapter()
Override to plug a sub-class of
RequestMappingHandlerAdapter . |
protected RequestMappingHandlerMapping |
createRequestMappingHandlerMapping()
Override to plug a sub-class of
RequestMappingHandlerMapping . |
protected void |
extendMessageReaders(List<HttpMessageReader<?>> messageReaders)
Override this to modify the list of message readers after it has been
configured, for example to add some in addition to the default ones.
|
protected void |
extendMessageWriters(List<HttpMessageWriter<?>> messageWriters)
Override this to modify the list of message writers after it has been
configured, for example to add some in addition to the default ones.
|
protected ApplicationContext |
getApplicationContext() |
protected Map<String,MediaType> |
getDefaultMediaTypeMappings()
Override to configure media type mappings.
|
protected List<HttpMessageReader<?>> |
getMessageReaders()
Main method to access message readers to use for decoding
controller method arguments with.
|
protected List<HttpMessageWriter<?>> |
getMessageWriters()
Main method to access message writers to use for encoding return values.
|
protected PathMatchConfigurer |
getPathMatchConfigurer()
Callback for building the
PathMatchConfigurer . |
protected Validator |
getValidator()
Override this method to provide a custom
Validator . |
CompositeContentTypeResolver |
mvcContentTypeResolver() |
FormattingConversionService |
mvcConversionService() |
Validator |
mvcValidator()
Return a global
Validator instance for example for validating
@RequestBody method arguments. |
RequestMappingHandlerAdapter |
requestMappingHandlerAdapter() |
RequestMappingHandlerMapping |
requestMappingHandlerMapping() |
HandlerMapping |
resourceHandlerMapping()
Return a handler mapping ordered at Integer.MAX_VALUE-1 with mapped
resource handlers.
|
ResponseBodyResultHandler |
responseBodyResultHandler() |
ResponseEntityResultHandler |
responseEntityResultHandler() |
void |
setApplicationContext(ApplicationContext applicationContext)
Set the ApplicationContext that this object runs in.
|
SimpleHandlerAdapter |
simpleHandlerAdapter() |
ViewResolutionResultHandler |
viewResolutionResultHandler() |
public void setApplicationContext(ApplicationContext applicationContext)
ApplicationContextAware
Invoked after population of normal bean properties but before an init callback such
as InitializingBean.afterPropertiesSet()
or a custom init-method. Invoked after ResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader)
,
ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)
and
MessageSourceAware
, if applicable.
setApplicationContext
in interface ApplicationContextAware
applicationContext
- the ApplicationContext object to be used by this objectBeanInitializationException
protected ApplicationContext getApplicationContext()
@Bean public RequestMappingHandlerMapping requestMappingHandlerMapping()
protected RequestMappingHandlerMapping createRequestMappingHandlerMapping()
RequestMappingHandlerMapping
.@Bean public CompositeContentTypeResolver mvcContentTypeResolver()
protected Map<String,MediaType> getDefaultMediaTypeMappings()
protected void configureRequestedContentTypeResolver(RequestedContentTypeResolverBuilder builder)
protected final PathMatchConfigurer getPathMatchConfigurer()
PathMatchConfigurer
. This method is
final, use configurePathMatching(org.springframework.web.reactive.config.PathMatchConfigurer)
to customize path matching.public void configurePathMatching(PathMatchConfigurer configurer)
@Bean public HandlerMapping resourceHandlerMapping()
addResourceHandlers(org.springframework.web.reactive.config.ResourceHandlerRegistry)
.protected void addResourceHandlers(ResourceHandlerRegistry registry)
ResourceHandlerRegistry
@Bean public RequestMappingHandlerAdapter requestMappingHandlerAdapter()
protected RequestMappingHandlerAdapter createRequestMappingHandlerAdapter()
RequestMappingHandlerAdapter
.protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers)
protected final List<HttpMessageReader<?>> getMessageReaders()
Use configureMessageReaders(java.util.List<org.springframework.http.codec.HttpMessageReader<?>>)
to configure the list or
extendMessageReaders(java.util.List<org.springframework.http.codec.HttpMessageReader<?>>)
to add in addition to the default ones.
protected void configureMessageReaders(List<HttpMessageReader<?>> messageReaders)
If no message readres are specified, default will be added via
addDefaultHttpMessageReaders(java.util.List<org.springframework.http.codec.HttpMessageReader<?>>)
.
messageReaders
- a list to add message readers to, initially an emptyprotected final void addDefaultHttpMessageReaders(List<HttpMessageReader<?>> readers)
configureMessageReaders(List)
.protected void extendMessageReaders(List<HttpMessageReader<?>> messageReaders)
@Bean public FormattingConversionService mvcConversionService()
protected void addFormatters(FormatterRegistry registry)
@Bean public Validator mvcValidator()
Validator
instance for example for validating
@RequestBody
method arguments.
Delegates to getValidator()
first. If that returns null
checks the classpath for the presence of a JSR-303 implementations
before creating a OptionalValidatorFactoryBean
. If a JSR-303
implementation is not available, a "no-op" Validator
is returned.
@Bean public SimpleHandlerAdapter simpleHandlerAdapter()
@Bean public ResponseEntityResultHandler responseEntityResultHandler()
@Bean public ResponseBodyResultHandler responseBodyResultHandler()
protected final List<HttpMessageWriter<?>> getMessageWriters()
Use configureMessageWriters(List)
to configure the list or
extendMessageWriters(List)
to add in addition to the default ones.
protected void configureMessageWriters(List<HttpMessageWriter<?>> messageWriters)
If no message readers are specified, default will be added via
addDefaultHttpMessageWriters(java.util.List<org.springframework.http.codec.HttpMessageWriter<?>>)
.
messageWriters
- a list to add message writers to, initially an emptyprotected final void addDefaultHttpMessageWriters(List<HttpMessageWriter<?>> writers)
configureMessageWriters(List)
.protected void extendMessageWriters(List<HttpMessageWriter<?>> messageWriters)
@Bean public ViewResolutionResultHandler viewResolutionResultHandler()
protected void configureViewResolvers(ViewResolverRegistry registry)