title: BeanFactoryUtils.beanOfType vs BeanFactoryUtils.beansOfTypeIncludingAncestors in spring
body: <p>Having this class:</p>
  
  <pre><code>public interface DeviceRule {
  }
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>@Service(value = "androidRule")
  @Transactional(propagation = Propagation.REQUIRED)
  public class AndroidRule implements DeviceRule {
  ..
  }
  </code></pre>
  
  <p>this method is working fine called in a service, getting AndroidRule</p>
  
  <pre><code>Map&lt;?, DeviceRule&gt; map = BeanFactoryUtils.beansOfTypeIncludingAncestors(context, DeviceRule.class, true, false);
  </code></pre>
  
  <p>but not this one:</p>
  
  <pre><code>BeanFactoryUtils.beanOfType(context, AndroidRule.class, true, false);
  </code></pre>
  
  <p>as I got this error:</p>
  
  <pre><code> org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'androidRule' must be of type [com.devices.AndroidRule], but was actually of type [com.sun.proxy.$Proxy302]:org.springframework.beans.factory.BeanNotOfRequiredTypeException:Bean named 'androidRule' must be of type [com.devices.AndroidRule], but was actually of type [com.sun.proxy.$Proxy302]
  </code></pre>
  
  <p>any idea ?</p>