Example #1
0
 @Bean(name = "conversionService")
 public FormattingConversionService conversionService() {
   FormattingConversionServiceFactoryBean bean = new FormattingConversionServiceFactoryBean();
   bean.setRegisterDefaultFormatters(false);
   bean.setFormatters(getFormatters());
   return bean.getObject();
 }
  @Bean
  public ConversionService conversionService() {
    FormattingConversionServiceFactoryBean factory = new FormattingConversionServiceFactoryBean();

    DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar();
    registrar.setUseIsoFormat(true);
    factory.setFormatterRegistrars(Collections.singleton(registrar));

    factory.afterPropertiesSet();
    return factory.getObject();
  }
 @Before
 public void setup() {
   this.mockMvc =
       MockMvcBuilders.standaloneSetup(petController)
           .setConversionService(formattingConversionServiceFactoryBean.getObject())
           .build();
 }
 @Override
 protected void installFormatters(FormatterRegistry registry) {
   super.installFormatters(registry);
   // Register application converters and formatters
 }
 @Override
 protected void installFormatters(FormatterRegistry registry) {
   super.installFormatters(registry);
 }
 public void afterPropertiesSet() {
   super.afterPropertiesSet();
   installLabelConverters(getObject());
 }
 @Override
 protected void installFormatters(FormatterRegistry registry) {
   super.installFormatters(registry);
   registry.addConverter(new IntsidentConverter());
   registry.addConverter(new VahtkondIntsidendisConverter());
 }