Java Code Examples for org.springframework.web.reactive.result.method.annotation.ArgumentResolverConfigurer

The following examples show how to use org.springframework.web.reactive.result.method.annotation.ArgumentResolverConfigurer. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   Source File: WebFluxConfigurationSupport.java    License: MIT License 6 votes vote down vote up
@Bean
public RequestMappingHandlerAdapter requestMappingHandlerAdapter(
		ReactiveAdapterRegistry webFluxAdapterRegistry,
		ServerCodecConfigurer serverCodecConfigurer,
		FormattingConversionService webFluxConversionService,
		Validator webfluxValidator) {
	RequestMappingHandlerAdapter adapter = createRequestMappingHandlerAdapter();
	adapter.setMessageReaders(serverCodecConfigurer.getReaders());
	adapter.setWebBindingInitializer(getConfigurableWebBindingInitializer(webFluxConversionService, webfluxValidator));
	adapter.setReactiveAdapterRegistry(webFluxAdapterRegistry);

	ArgumentResolverConfigurer configurer = new ArgumentResolverConfigurer();
	configureArgumentResolvers(configurer);
	adapter.setArgumentResolverConfigurer(configurer);

	return adapter;
}
 
Example 2
Source Project: spring-analysis-note   Source File: DefaultControllerSpecTests.java    License: MIT License 5 votes vote down vote up
@Test
public void configurerConsumers() {
	TestConsumer<ArgumentResolverConfigurer> argumentResolverConsumer = new TestConsumer<>();
	TestConsumer<RequestedContentTypeResolverBuilder> contenTypeResolverConsumer = new TestConsumer<>();
	TestConsumer<CorsRegistry> corsRegistryConsumer = new TestConsumer<>();
	TestConsumer<FormatterRegistry> formatterConsumer = new TestConsumer<>();
	TestConsumer<ServerCodecConfigurer> codecsConsumer = new TestConsumer<>();
	TestConsumer<PathMatchConfigurer> pathMatchingConsumer = new TestConsumer<>();
	TestConsumer<ViewResolverRegistry> viewResolverConsumer = new TestConsumer<>();

	new DefaultControllerSpec(new MyController())
			.argumentResolvers(argumentResolverConsumer)
			.contentTypeResolver(contenTypeResolverConsumer)
			.corsMappings(corsRegistryConsumer)
			.formatters(formatterConsumer)
			.httpMessageCodecs(codecsConsumer)
			.pathMatching(pathMatchingConsumer)
			.viewResolvers(viewResolverConsumer)
			.build();

	assertNotNull(argumentResolverConsumer.getValue());
	assertNotNull(contenTypeResolverConsumer.getValue());
	assertNotNull(corsRegistryConsumer.getValue());
	assertNotNull(formatterConsumer.getValue());
	assertNotNull(codecsConsumer.getValue());
	assertNotNull(pathMatchingConsumer.getValue());
	assertNotNull(viewResolverConsumer.getValue());

}
 
Example 3
@Bean
public RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
	RequestMappingHandlerAdapter adapter = createRequestMappingHandlerAdapter();
	adapter.setMessageReaders(serverCodecConfigurer().getReaders());
	adapter.setWebBindingInitializer(getConfigurableWebBindingInitializer());
	adapter.setReactiveAdapterRegistry(webFluxAdapterRegistry());

	ArgumentResolverConfigurer configurer = new ArgumentResolverConfigurer();
	configureArgumentResolvers(configurer);
	adapter.setArgumentResolverConfigurer(configurer);

	return adapter;
}
 
Example 4
Source Project: java-technology-stack   Source File: DefaultControllerSpecTests.java    License: MIT License 5 votes vote down vote up
@Test
public void configurerConsumers() {
	TestConsumer<ArgumentResolverConfigurer> argumentResolverConsumer = new TestConsumer<>();
	TestConsumer<RequestedContentTypeResolverBuilder> contenTypeResolverConsumer = new TestConsumer<>();
	TestConsumer<CorsRegistry> corsRegistryConsumer = new TestConsumer<>();
	TestConsumer<FormatterRegistry> formatterConsumer = new TestConsumer<>();
	TestConsumer<ServerCodecConfigurer> codecsConsumer = new TestConsumer<>();
	TestConsumer<PathMatchConfigurer> pathMatchingConsumer = new TestConsumer<>();
	TestConsumer<ViewResolverRegistry> viewResolverConsumer = new TestConsumer<>();

	new DefaultControllerSpec(new MyController())
			.argumentResolvers(argumentResolverConsumer)
			.contentTypeResolver(contenTypeResolverConsumer)
			.corsMappings(corsRegistryConsumer)
			.formatters(formatterConsumer)
			.httpMessageCodecs(codecsConsumer)
			.pathMatching(pathMatchingConsumer)
			.viewResolvers(viewResolverConsumer)
			.build();

	assertNotNull(argumentResolverConsumer.getValue());
	assertNotNull(contenTypeResolverConsumer.getValue());
	assertNotNull(corsRegistryConsumer.getValue());
	assertNotNull(formatterConsumer.getValue());
	assertNotNull(codecsConsumer.getValue());
	assertNotNull(pathMatchingConsumer.getValue());
	assertNotNull(viewResolverConsumer.getValue());

}
 
Example 5
Source Project: spring-analysis-note   Source File: WebFluxConfigurerComposite.java    License: MIT License 4 votes vote down vote up
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	this.delegates.forEach(delegate -> delegate.configureArgumentResolvers(configurer));
}
 
Example 6
@Override
protected void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	this.configurers.configureArgumentResolvers(configurer);
}
 
Example 7
Source Project: spring-analysis-note   Source File: DefaultControllerSpec.java    License: MIT License 4 votes vote down vote up
@Override
public DefaultControllerSpec argumentResolvers(Consumer<ArgumentResolverConfigurer> consumer) {
	this.configurer.argumentResolverConsumer = consumer;
	return this;
}
 
Example 8
Source Project: spring-analysis-note   Source File: DefaultControllerSpec.java    License: MIT License 4 votes vote down vote up
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	if (this.argumentResolverConsumer != null) {
		this.argumentResolverConsumer.accept(configurer);
	}
}
 
Example 9
Source Project: java-technology-stack   Source File: WebFluxConfigurerComposite.java    License: MIT License 4 votes vote down vote up
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	this.delegates.forEach(delegate -> delegate.configureArgumentResolvers(configurer));
}
 
Example 10
@Override
protected void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	this.configurers.configureArgumentResolvers(configurer);
}
 
Example 11
Source Project: java-technology-stack   Source File: DefaultControllerSpec.java    License: MIT License 4 votes vote down vote up
@Override
public DefaultControllerSpec argumentResolvers(Consumer<ArgumentResolverConfigurer> consumer) {
	this.configurer.argumentResolverConsumer = consumer;
	return this;
}
 
Example 12
Source Project: java-technology-stack   Source File: DefaultControllerSpec.java    License: MIT License 4 votes vote down vote up
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	if (this.argumentResolverConsumer != null) {
		this.argumentResolverConsumer.accept(configurer);
	}
}
 
Example 13
Source Project: spring-security-reactive   Source File: Application.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	configurer.addCustomResolver(authenticationPrincipalArgumentResolver());
}
 
Example 14
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	WebFluxConfigurer.super.configureArgumentResolvers(configurer);
	configurer
			.addCustomResolver(context.getBean(ProxyExchangeArgumentResolver.class));
}
 
Example 15
Source Project: spring-analysis-note   Source File: WebFluxConfigurer.java    License: MIT License 2 votes vote down vote up
/**
 * Configure resolvers for custom {@code @RequestMapping} method arguments.
 * @param configurer to configurer to use
 */
default void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
}
 
Example 16
Source Project: spring-analysis-note   Source File: WebFluxConfigurationSupport.java    License: MIT License 2 votes vote down vote up
/**
 * Configure resolvers for custom controller method arguments.
 */
protected void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
}
 
Example 17
Source Project: spring-analysis-note   Source File: WebTestClient.java    License: MIT License 2 votes vote down vote up
/**
 * Configure resolvers for custom controller method arguments.
 * @see WebFluxConfigurer#configureHttpMessageCodecs
 */
ControllerSpec argumentResolvers(Consumer<ArgumentResolverConfigurer> configurer);
 
Example 18
Source Project: java-technology-stack   Source File: WebFluxConfigurer.java    License: MIT License 2 votes vote down vote up
/**
 * Configure resolvers for custom {@code @RequestMapping} method arguments.
 * @param configurer to configurer to use
 */
default void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
}
 
Example 19
/**
 * Configure resolvers for custom controller method arguments.
 */
protected void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
}
 
Example 20
Source Project: java-technology-stack   Source File: WebTestClient.java    License: MIT License 2 votes vote down vote up
/**
 * Configure resolvers for custom controller method arguments.
 * @see WebFluxConfigurer#configureHttpMessageCodecs
 */
ControllerSpec argumentResolvers(Consumer<ArgumentResolverConfigurer> configurer);