title: How to replace deprecated class method?
body: <p>I found a piece of code that I wanted to implement in my application. The code works fine, but has <code>Deprecated</code> methods. The code I'm talking about is:</p>
  
  <pre><code>public class WebConfig extends WebMvcConfigurerAdapter {
  
  @Override
  public void addArgumentResolvers(List&lt;HandlerMethodArgumentResolver&gt; argumentResolvers) {
      PageableHandlerMethodArgumentResolver resolver = new PageableHandlerMethodArgumentResolver();
      resolver.setFallbackPageable(new PageRequest(0, 20));
      argumentResolvers.add(resolver);
      super.addArgumentResolvers(argumentResolvers);
  }
  
  }
  </code></pre>
  
  <p>And specifically the <code>Deprecated</code> class is <code>WebMvcConfigurerAdapter</code> and it's method <code>addArgumentResolvers</code>. According to documentation: </p>
  
  <blockquote>
    <p>as of 5.0 WebMvcConfigurer has default methods (made possible by a Java 8 baseline) and can be implemented directly without the need for this adapter</p>
  </blockquote>
  
  <p>And so I've replaced the deprecated class with a <code>interface</code> - <code>WebMvcConfigurer</code>. Problem is the interface won't allow me to use <code>addArgumentResolvers</code> method. What do I do now? Should I create an instance of the <code>interface</code>? Are there any drawbacks to using a deprecated methods?</p>