The actual type of the bean, for Spring, is the type of its interface, and not its concrete type. So you should have
@Autowired
private ObjectDAO jpa;
and not
@Autowired
private ObjectJPA jpa;
Indeed, Spring by default uses Java interface proxies to implement AOP. And it thus needs to inject its own proxy, which implements all the interfaces of your bean and wraps it, but is not an instance of its concrete class. And that's not a problem, because the whole point of using interfaces is to use them when referencing objects, rather than using the concrete type of the object (just like you use the type List
to refer to a List, and not the type ArrayList
).