use of org.springframework.format.support.DefaultFormattingConversionService in project spring-framework by spring-projects.
the class RequestHeaderMethodArgumentResolverTests method setup.
@Before
public void setup() throws Exception {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.refresh();
ReactiveAdapterRegistry adapterRegistry = new ReactiveAdapterRegistry();
this.resolver = new RequestHeaderMethodArgumentResolver(context.getBeanFactory(), adapterRegistry);
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
initializer.setConversionService(new DefaultFormattingConversionService());
this.bindingContext = new BindingContext(initializer);
Method method = ReflectionUtils.findMethod(getClass(), "params", (Class<?>[]) null);
this.paramNamedDefaultValueStringHeader = new SynthesizingMethodParameter(method, 0);
this.paramNamedValueStringArray = new SynthesizingMethodParameter(method, 1);
this.paramSystemProperty = new SynthesizingMethodParameter(method, 2);
this.paramResolvedNameWithExpression = new SynthesizingMethodParameter(method, 3);
this.paramResolvedNameWithPlaceholder = new SynthesizingMethodParameter(method, 4);
this.paramNamedValueMap = new SynthesizingMethodParameter(method, 5);
this.paramDate = new SynthesizingMethodParameter(method, 6);
this.paramInstant = new SynthesizingMethodParameter(method, 7);
this.paramMono = new SynthesizingMethodParameter(method, 8);
}
use of org.springframework.format.support.DefaultFormattingConversionService in project spring-framework by spring-projects.
the class WebMvcConfigurationSupport method mvcConversionService.
/**
* Return a {@link FormattingConversionService} for use with annotated
* controller methods and the {@code spring:eval} JSP tag.
* Also see {@link #addFormatters} as an alternative to overriding this method.
*/
@Bean
public FormattingConversionService mvcConversionService() {
FormattingConversionService conversionService = new DefaultFormattingConversionService();
addFormatters(conversionService);
return conversionService;
}
use of org.springframework.format.support.DefaultFormattingConversionService in project cas by apereo.
the class EnvironmentConversionServiceInitializer method initialize.
@Override
public void initialize(final ConfigurableApplicationContext applicationContext) {
final DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService(true);
applicationContext.getEnvironment().setConversionService(conversionService);
}
use of org.springframework.format.support.DefaultFormattingConversionService in project cas by apereo.
the class CasCoreUtilConfiguration method init.
@PostConstruct
public void init() {
final ConfigurableApplicationContext applicationContext = applicationContextProvider().getConfigurableApplicationContext();
final DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService(true);
applicationContext.getEnvironment().setConversionService(conversionService);
final ScheduledAnnotationBeanPostProcessor p = applicationContext.getBean(ScheduledAnnotationBeanPostProcessor.class);
p.setEmbeddedValueResolver(new CasConfigurationEmbeddedValueResolver(applicationContext));
}
use of org.springframework.format.support.DefaultFormattingConversionService in project spring-framework by spring-projects.
the class InitBinderBindingContextTests method createBinderWithGlobalInitialization.
@Test
public void createBinderWithGlobalInitialization() throws Exception {
ConversionService conversionService = new DefaultFormattingConversionService();
bindingInitializer.setConversionService(conversionService);
ServerWebExchange exchange = MockServerHttpRequest.get("/").toExchange();
BindingContext context = createBindingContext("initBinder", WebDataBinder.class);
WebDataBinder dataBinder = context.createDataBinder(exchange, null, null);
assertSame(conversionService, dataBinder.getConversionService());
}
Aggregations