类 RequestMappingHandlerAdapter
- java.lang.Object
- org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter
- 所有已实现的接口:
Aware
,InitializingBean
,ApplicationContextAware
,HandlerAdapter
public class RequestMappingHandlerAdapter extends Object implements HandlerAdapter, ApplicationContextAware, InitializingBean
Supports the invocation of@RequestMapping
handler methods.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 RequestMappingHandlerAdapter()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.ArgumentResolverConfigurer
getArgumentResolverConfigurer()
Return the configured resolvers for controller method arguments.List<HttpMessageReader<?>>
getMessageReaders()
Return the configurer for HTTP message readers.ReactiveAdapterRegistry
getReactiveAdapterRegistry()
Return the configured registry for adapting reactive types.WebBindingInitializer
getWebBindingInitializer()
Return the configured WebBindingInitializer, ornull
if none.reactor.core.publisher.Mono<HandlerResult>
handle(ServerWebExchange exchange, Object handler)
Handle the request with the given handler.void
setApplicationContext(ApplicationContext applicationContext)
AConfigurableApplicationContext
is expected for resolving expressions in method argument default values as well as for detecting@ControllerAdvice
beans.void
setArgumentResolverConfigurer(ArgumentResolverConfigurer configurer)
Configure resolvers for controller method arguments.void
setMessageReaders(List<HttpMessageReader<?>> messageReaders)
Configure HTTP message readers to de-serialize the request body with.void
setReactiveAdapterRegistry(ReactiveAdapterRegistry registry)
Configure the registry for adapting various reactive types.void
setWebBindingInitializer(WebBindingInitializer webBindingInitializer)
Provide a WebBindingInitializer with "global" initialization to apply to every DataBinder instance.boolean
supports(Object handler)
Whether thisHandlerAdapter
supports the givenhandler
.
构造器详细资料
RequestMappingHandlerAdapter
public RequestMappingHandlerAdapter()
方法详细资料
setMessageReaders
public void setMessageReaders(List<HttpMessageReader<?>> messageReaders)
Configure HTTP message readers to de-serialize the request body with.By default this is set to
ServerCodecConfigurer
's readers with defaults.
getMessageReaders
public List<HttpMessageReader<?>> getMessageReaders()
Return the configurer for HTTP message readers.
setWebBindingInitializer
public void setWebBindingInitializer(@Nullable WebBindingInitializer webBindingInitializer)
Provide a WebBindingInitializer with "global" initialization to apply to every DataBinder instance.
getWebBindingInitializer
@Nullable public WebBindingInitializer getWebBindingInitializer()
Return the configured WebBindingInitializer, ornull
if none.
setArgumentResolverConfigurer
public void setArgumentResolverConfigurer(@Nullable ArgumentResolverConfigurer configurer)
Configure resolvers for controller method arguments.
getArgumentResolverConfigurer
@Nullable public ArgumentResolverConfigurer getArgumentResolverConfigurer()
Return the configured resolvers for controller method arguments.
setReactiveAdapterRegistry
public void setReactiveAdapterRegistry(@Nullable ReactiveAdapterRegistry registry)
Configure the registry for adapting various reactive types.By default this is an instance of
ReactiveAdapterRegistry
with default settings.
getReactiveAdapterRegistry
@Nullable public ReactiveAdapterRegistry getReactiveAdapterRegistry()
Return the configured registry for adapting reactive types.
setApplicationContext
public void setApplicationContext(ApplicationContext applicationContext)
AConfigurableApplicationContext
is expected for resolving expressions in method argument default values as well as for detecting@ControllerAdvice
beans.- 指定者:
setApplicationContext
在接口中ApplicationContextAware
- 参数:
applicationContext
- the ApplicationContext object to be used by this object- 另请参阅:
BeanInitializationException
afterPropertiesSet
public void afterPropertiesSet() throws Exception
从接口复制的说明:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,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.
- 指定者:
afterPropertiesSet
在接口中InitializingBean
- 抛出:
Exception
- in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
supports
public boolean supports(Object handler)
从接口复制的说明:HandlerAdapter
Whether thisHandlerAdapter
supports the givenhandler
.- 指定者:
supports
在接口中HandlerAdapter
- 参数:
handler
- the handler object to check- 返回:
- whether or not the handler is supported
handle
public reactor.core.publisher.Mono<HandlerResult> handle(ServerWebExchange exchange, Object handler)
从接口复制的说明:HandlerAdapter
Handle the request with the given handler.Implementations are encouraged to handle exceptions resulting from the invocation of a handler in order and if necessary to return an alternate result that represents an error response.
Furthermore since an async
HandlerResult
may produce an error later during result handling implementations are also encouraged toset an exception handler
on theHandlerResult
so that may also be applied later after result handling.- 指定者:
handle
在接口中HandlerAdapter
- 参数:
exchange
- current server exchangehandler
- the selected handler which must have been previously checked viaHandlerAdapter.supports(Object)
- 返回:
Mono
that emits a singleHandlerResult
or none if the request has been fully handled and doesn't require further handling.