title: How to inject dependency into Jackson Custom deserializer
body: <p>I want to enable a custom jackson deserializer of some fields of type String. The deserializer also needs to be injected with a guice based dependency bean. SampleCode below:</p>
  
  <pre><code>public class CustomDeserializer extends StdDeserializer&lt;String&gt; {
  
      private SomeDependecy dependency;
  
      public StringDeserializer() {
          this(null);
      }
  
      public StringDeserializer(Class&lt;?&gt; vc) {
          super(vc);
      }
  
      @Override
      public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
          return dependency.perform(p.getValueAsString());
      }
  }
  </code></pre>
  
  <p>I cannot register a module based on Class type as it is generic  (String.class, Complex Datatype( but not every one require a custome deserializer)). Is there a way to achieve the above without using static methods?</p>
  
  <p>PS: I did search net but could not find a cleaner solution without using statics . All the suggestions where around using Some static method to get context and bean. </p>