Normally, both will work, you can autowire interfaces or classes.
There's probably an autoproxy generator somewhere in your context, which is wrapping your boo
bean in a generated proxy object. This proxy object will implement TheInterface
, but will not be a TheClass
. When using autoproxies, you need to program to the interface, not the implementation.
The likely candidate is transactional proxies - are you using Spring transactions, using AspectJ or @Transactional
?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…