title: Custom AnnotationFormatterFactory doesn't work
body: <p>I'm trying to get my Formatter for my model running. The model contains an annotation like the following code. I have multiple Formatter i don't get running yet, but can't figure out the issue.</p>
  
  <pre><code>public class Customer {
      @Trim
      private String firstName;
      //some other properties, getter and setter
  }
  </code></pre>
  
  <p>The annotation is correctly set, as far as i know:</p>
  
  <pre><code>@Documented
  @Retention(RetentionPolicy.RUNTIME)
  @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE})
  public @interface Trim {
      boolean squashMultipleSpaces() default true;
  }
  </code></pre>
  
  <p>And the AnnotationFormatterFactory</p>
  
  <pre><code>public class TrimAnnotationFormatterFactory implements AnnotationFormatterFactory&lt;Trim&gt; {
      public TrimAnnotationFormatterFactory() {
      }
  
      public Set&lt;Class&lt;?&gt;&gt; getFieldTypes() {
          return Collections.singleton(String.class);
      }
  
      public Printer&lt;String&gt; getPrinter(Trim annotation, Class&lt;?&gt; fieldType) {
          return new TrimAnnotationFormatterFactory.TrimFormatter(annotation.squashMultipleSpaces());
      }
  
      public Parser&lt;String&gt; getParser(Trim annotation, Class&lt;?&gt; fieldType) {
          return new TrimAnnotationFormatterFactory.TrimFormatter(annotation.squashMultipleSpaces());
      }
  
      private static class TrimFormatter implements Formatter&lt;String&gt; {
          private final boolean squashMultipleSpaces;
  
          TrimFormatter(boolean squashMultipleSpaces) {
              this.squashMultipleSpaces = squashMultipleSpaces;
          }
  
          public String parse(String text, Locale locale) {
              return this.process(text);
          }
  
          public String print(String object, Locale locale) {
              return this.process(object);
          }
  
          private String process(String text) {
              if (text == null) {
                  return null;
              } else {
                  return this.squashMultipleSpaces ? text.trim().replaceAll("\\s+", " ") : text.trim();
              }
          }
      }
  }
  </code></pre>
  
  <p>I added my custom AnnotationFormatterFactory to the FormatterRegistry. When I'm dbuggign it, i can see that it is added to the FormatterRegistry successfully.</p>
  
  <pre><code>@Configuration
  public class WebMvcConfig implements WebMvcConfigurer {
  
      @Override
      public void addFormatters(FormatterRegistry registry) {
          registry.addFormatterForFieldAnnotation(new TrimAnnotationFormatterFactory());
      }
  }
  </code></pre>
  
  <p>And the controller looks like:</p>
  
  <pre><code>@Controller
  public class CustomerController {
  
      @PostMapping(value = "/customer")
      @ResponseBody
      public Customer saveCustomer(@RequestBody Customer customer) {
          return customer;
      }
  }
  </code></pre>
  
  <p>if my input looks like this</p>
  
  <pre><code>"       Christian     Walter"
  </code></pre>
  
  <p>in the controller the model is still the same. I was expecting </p>
  
  <pre><code>"Christian Walter"
  </code></pre>
  
  <p>in my model.</p>
  
  <p>Why doesn't my formatter work? Or do i have to use PropertyEditor and if so, how could i use it with annotations?</p>
  
  <p>UPDATE: The formatter is successfully registered, but isn't called. And added the controller.</p>
  
  <p>Thanks for your help.</p>