本文整理匯總了Java中org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.getReturnValueHandlers方法的典型用法代碼示例。如果您正苦於以下問題:Java RequestMappingHandlerAdapter.getReturnValueHandlers方法的具體用法?Java RequestMappingHandlerAdapter.getReturnValueHandlers怎麽用?Java RequestMappingHandlerAdapter.getReturnValueHandlers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
的用法示例。
在下文中一共展示了RequestMappingHandlerAdapter.getReturnValueHandlers方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fluxRequestMappingHandlerAdapterProcessor
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; //導入方法依賴的package包/類
@Bean
public SmartInitializingSingleton fluxRequestMappingHandlerAdapterProcessor(
RequestMappingHandlerAdapter adapter,
FluxHandlerMethodArgumentResolver resolver) {
return new SmartInitializingSingleton() {
@Override
public void afterSingletonsInstantiated() {
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>(
adapter.getArgumentResolvers());
resolvers.add(0, resolver);
adapter.setArgumentResolvers(resolvers);
if (!ClassUtils.isPresent("org.springframework.core.ReactiveAdapter",
null)) {
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>(
adapter.getReturnValueHandlers());
handlers.add(0, context.getBean(FluxReturnValueHandler.class));
adapter.setReturnValueHandlers(handlers);
}
}
};
}
示例2: install
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; //導入方法依賴的package包/類
public GuavaLFReturnValueHandler install(RequestMappingHandlerAdapter requestMappingHandlerAdapter) {
final List<HandlerMethodReturnValueHandler> originalHandlers = new ArrayList<>(
requestMappingHandlerAdapter.getReturnValueHandlers());
final int deferredPos = indexOfType(originalHandlers, DeferredResultMethodReturnValueHandler.class);
// Add our handler directly after the deferred handler.
originalHandlers.add(deferredPos + 1, this);
requestMappingHandlerAdapter.setReturnValueHandlers(originalHandlers);
return this;
}
示例3: returnValueHandlers
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; //導入方法依賴的package包/類
@Bean
public List<HandlerMethodReturnValueHandler> returnValueHandlers(RequestMappingHandlerAdapter requestMappingHandlerAdapter) {
final List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>(requestMappingHandlerAdapter.getReturnValueHandlers());
handlers.add(0, new ObserableReturnValueHandler());
handlers.add(0, new ListenableFutureReturnValueHandler());
requestMappingHandlerAdapter.setReturnValueHandlers(handlers);
return handlers;
}