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

The following examples show how to use org.springframework.web.reactive.result.method.annotation.ArgumentResolverConfigurer. 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 File: WebFluxConfigurationSupport.java    From spring-analysis-note with 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 File: DefaultControllerSpecTests.java    From java-technology-stack with 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
Source File: DefaultControllerSpecTests.java    From spring-analysis-note with 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 #4
Source File: WebFluxConfigurationSupport.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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 #5
Source File: ProxyResponseAutoConfiguration.java    From spring-cloud-gateway with Apache License 2.0 4 votes vote down vote up
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	WebFluxConfigurer.super.configureArgumentResolvers(configurer);
	configurer
			.addCustomResolver(context.getBean(ProxyExchangeArgumentResolver.class));
}
 
Example #6
Source File: Application.java    From spring-security-reactive with Apache License 2.0 4 votes vote down vote up
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	configurer.addCustomResolver(authenticationPrincipalArgumentResolver());
}
 
Example #7
Source File: DelegatingWebFluxConfiguration.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
protected void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	this.configurers.configureArgumentResolvers(configurer);
}
 
Example #8
Source File: DefaultControllerSpec.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public DefaultControllerSpec argumentResolvers(Consumer<ArgumentResolverConfigurer> consumer) {
	this.configurer.argumentResolverConsumer = consumer;
	return this;
}
 
Example #9
Source File: DefaultControllerSpec.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	if (this.argumentResolverConsumer != null) {
		this.argumentResolverConsumer.accept(configurer);
	}
}
 
Example #10
Source File: WebFluxConfigurerComposite.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	this.delegates.forEach(delegate -> delegate.configureArgumentResolvers(configurer));
}
 
Example #11
Source File: WebFluxConfigurerComposite.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	this.delegates.forEach(delegate -> delegate.configureArgumentResolvers(configurer));
}
 
Example #12
Source File: DefaultControllerSpec.java    From java-technology-stack with 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 File: DelegatingWebFluxConfiguration.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
protected void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
	this.configurers.configureArgumentResolvers(configurer);
}
 
Example #14
Source File: DefaultControllerSpec.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public DefaultControllerSpec argumentResolvers(Consumer<ArgumentResolverConfigurer> consumer) {
	this.configurer.argumentResolverConsumer = consumer;
	return this;
}
 
Example #15
Source File: WebFluxConfigurer.java    From java-technology-stack with 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 File: WebTestClient.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Configure resolvers for custom controller method arguments.
 * @see WebFluxConfigurer#configureHttpMessageCodecs
 */
ControllerSpec argumentResolvers(Consumer<ArgumentResolverConfigurer> configurer);
 
Example #17
Source File: WebFluxConfigurationSupport.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Configure resolvers for custom controller method arguments.
 */
protected void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
}
 
Example #18
Source File: WebTestClient.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Configure resolvers for custom controller method arguments.
 * @see WebFluxConfigurer#configureHttpMessageCodecs
 */
ControllerSpec argumentResolvers(Consumer<ArgumentResolverConfigurer> configurer);
 
Example #19
Source File: WebFluxConfigurationSupport.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Configure resolvers for custom controller method arguments.
 */
protected void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
}
 
Example #20
Source File: WebFluxConfigurer.java    From spring-analysis-note with 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) {
}