title: Custom Converter with Spring Boot Webflux is not called
body: <p>Using <code>spring-boot-starter-webflux</code> in version 2.3.3 with Java 14, I am trying to register a custom converter to convert a String input to an enum. The problem I have is that upon execution the underlying Jackson library tries to convert the String without considering the custom converter I have registered.</p>
  <p>Here is the controller I use:</p>
  <pre class="lang-java prettyprint-override"><code>@RestController
  public class MyController {
  
      private final MyService myService;
  
  
      @Autowired
      public MyController(MyService myService) {
          this.myService = myService;
      }
  
      @PostMapping(value = &quot;/subscriptions&quot;)
      public CreateSubscriptionOutput createSubscription(@RequestBody @Valid CreateSubscriptionInput input) throws Exception {
          return myService.createSubscription(input);
      }
  
  }
  </code></pre>
  <p>The input definition is as follows:</p>
  <pre class="lang-java prettyprint-override"><code>public class CreateSubscriptionInput {
  
      private EventType eventType;
  
      public CreateSubscriptionInput() {
          this.eventType = EventType.A;
      }
  
      public CreateSubscriptionInput(EventType type) {
          this.eventType = type;
      }
  
      public EventType getEventType() {
          return this.eventType;
      }
  
  }
  
  public enum EventType implements SafeEnum {
  
      A(0L, &quot;a&quot;),
      B(1L, &quot;b&quot;),
     
      private final long id;
      private final String name;
  
      public static EventType from(long id) {
          return (EventType) Enums.from(EventType.class, id);
      }
  
      public static EventType from(String name) {
          return (EventType) Enums.from(EventType.class, name);
      }
  
      private EventType(long id, String name) {
          this.id = id;
          this.name = name;
      }
  
      public long getId() {
          return this.id;
      }
  
      public String getName() {
          return this.name;
      }
  
  }
  
  public interface SafeEnum {
  
      long getId();
  
      String getName();
  
  }
  
  public final class Enums {
  
      public static &lt;E extends Enum&lt;E&gt; &amp; SafeEnum&gt; E from(Class&lt;E&gt; clazz, long id) {
          for (E e : EnumSet.allOf(clazz)) {
              if (e.getId() == id) {
                  return e;
              }
          }
  
          throw new IllegalArgumentException(&quot;Unknown &quot; + clazz.getSimpleName() + &quot; id: &quot; + id);
      }
  
      public static &lt;E extends Enum&lt;E&gt; &amp; SafeEnum&gt; E from(Class&lt;E&gt; clazz, String name) {
          if (name == null) {
              return null;
          }
  
          for (E e : EnumSet.allOf(clazz)) {
              if (e.getName().equals(name)) {
                  return e;
              }
          }
  
          throw new IllegalArgumentException(&quot;Unknown &quot; + clazz.getSimpleName() + &quot; name: &quot; + name);
      }
  
  }
  
  </code></pre>
  <p>The custom converter is defined and registered as follows:</p>
  <pre class="lang-java prettyprint-override"><code>@Configuration
  @EnableWebFlux
  public class ApplicationConfiguration implements WebFluxConfigurer {
  
      @Override
      public void addFormatters(FormatterRegistry registry) {
          registry.addConverter(new Converter&lt;String, EventType&gt;() {
              @Override
              public EventType convert(String source) {
                  return EventType.from(source);
              }
          });
      }
  </code></pre>
  <p>The purpose is to convert &quot;a&quot; to <code>EventType.A</code>.</p>
  <p>When I invoke the REST resource as follows:</p>
  <pre><code>curl --location --request POST 'http://localhost:8081/subscriptions' \
       --header 'Content-Type: application/json' \
       --data-raw '{
           &quot;eventType&quot;: &quot;a&quot;,
       }'
  </code></pre>
  <p>I get a 400 error with the following internal error:</p>
  <blockquote>
  <p>JSON decoding error: Cannot deserialize value of type
  <code>my.app.EventType</code> from String &quot;a&quot;: not one of the values accepted for
  Enum class: [A, B]</p>
  </blockquote>
  <p>This lets me think the converter is never called. Running the code in debug confirms this assumption. Setting the root logger in DEBUG seems not to print information about registered converters.</p>
  <p>Is there something wrong with how I register the converter? what is missing?</p>