title: @ConfigurationProperties on inherited variable
body: <p>I have a superclass that looks like this</p>
  
  <pre><code>public class MyProvider {
      private Integer id;
      private ProviderAccount account;
  }
  </code></pre>
  
  <p>An extending class</p>
  
  <pre><code>@Component
  @ConfigurationProperties(prefix = "provider.custom")
  public class CustomProvider extends MyProvider {
  //this should have CustomProviderAccount
  }
  </code></pre>
  
  <p>config for <code>provider.custom</code></p>
  
  <pre><code>provider.custom.account.index=1
  provider.custom.account.enabled=false
  provider.custom.account.description=New Live
  </code></pre>
  
  <p>Account classes</p>
  
  <pre><code>public class ProviderAccount {
      private Integer index;
  }
  
  public class CustomProviderAccount extends ProviderAccount {
      private boolean enabled;
      private String description;
  }
  </code></pre>
  
  <p>When I try to cast <code>CustomProvider.getAccount()</code> from <code>ProviderAccount</code> to <code>CustomProviderAccount</code> I get an exception that I cannot cast.</p>
  
  <blockquote>
    <p>Caused by: java.lang.ClassCastException:
    com.example.bean.hrs.ProviderAccount cannot be cast to
    com.triphop.bean.hrs.CustomProviderAccount at
    com.triphop.service.HRSServiceImpl.test(HRSServiceImpl.java:205)  at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)</p>
  </blockquote>
  
  <p>Any idea how can I achieve this in Spring?</p>