title: Spring error : BeanNotOfRequiredTypeException
body: <p>My controller contains the following annotation :</p>
  
  <pre><code>@Resource(name="userService")
  private UserDetailsServiceImpl userService;
  </code></pre>
  
  <p>and the service itself has the following :</p>
  
  <pre><code>@Service("userService")
  @Transactional
  public class UserDetailsServiceImpl implements UserDetailsService {
  
      @Resource(name = "sessionFactory")
      private SessionFactory sessionFactory;
  </code></pre>
  
  <p>However I receive the following error on startup :</p>
  
  <blockquote>
    <p>Injection of resource dependencies
    failed; nested exception is
    org.springframework.beans.factory.BeanNotOfRequiredTypeException:
    Bean named 'userDetailsServiceImpl'
    must be of type
    [myapp.service.UserDetailsServiceImpl], but was actually of
    type [$Proxy19]</p>
  </blockquote>