I have a spring bean that extends HibernateDaoSupport
. I want this bean injected into my Controllers, but I do NOT want it to implement any interface. I just w
you can write everything including the mapped controller in the xml as beans, then you don't need to write interfaces. otherwise, with using annotation you need to build interfaces to proxy them.
If class to be proxied (by transactional proxy in your case) implements any interface (InitializingBean
implemented by HibernateDaoSupport
in your case), Spring by default uses proxying strategy based on JDK dynamic proxies.
So, it creates a proxy of type InitializingBean
, that, obviously, cannot be injected into a field of type MySampleService
.
If you don't want to use interface you can override the strategy used by transactional aspect by declaring <tx:annotation-driven>
with proxy-target-class = "true"
.
See also:
Check the following. Ensure you have CGLIB on your classpath.
http://static.springsource.org/spring/docs/3.0.0.M3/spring-framework-reference/html/ch08s06.html