title: How to deserialize json to enum with jackson in java?
body: <p>I have an interface with name Field as below:</p>
  
  <pre><code>public interface Field {
  }
  </code></pre>
  
  <p>This interface is in the module <strong>A</strong>.
  I have an enum called BField which is in module <strong>B</strong> and is implemented as below:</p>
  
  <pre><code>public enum BField implements Field {
      SOME_FIELD
  }
  </code></pre>
  
  <p>There is a class named C in the module <strong>A</strong> as below:</p>
  
  <pre><code>public class C implements Serializable {
      private Set&lt;Field&gt; f;
  
      public Set&lt;Field&gt; getF() { return f; }
      public void setF(Set&lt;Field&gt; f) { this f = f; }
  }
  </code></pre>
  
  <p>I have a REST method as below:</p>
  
  <pre><code>@RequestMapping(method=RequestMethod.Post, value="/save")
  @ResponseBody
  public void save (@RequestBody C c) {
      //save c
  }
  </code></pre>
  
  <p>I send this JSON object to this method:</p>
  
  <pre><code>{
      "f": ["SOME_FIELD"]
  }
  </code></pre>
  
  <p>then I get HTTP 400 bad request error code with the following exception log:</p>
  
  <blockquote>
    <p>abstract types can only be instantiated with additional type
    information</p>
  </blockquote>
  
  <p>The hierarchy of the modules is module <strong>B</strong> is dependent to module <strong>A</strong>. I tried to use @JsonTypeInfo but the dependency between modules works as a limit and does not let me to use BField.class in the @JsonSubTypes annotation for the field f in class C.</p>