Spring Java config, @Autowire vs. Constructor Injection, @Transactional and CGLIBBasically, yes. But if that "anything" is literally a java interface then Spring framework won't use cglib at all, and will use the standard JDK API. Also keep in mind that cglib proxy class inherits all the fields but they are never used as the proxy method calls will delegate the work to the original bean behind the proxy(and you have to watch that all public methods are not final), so the java interface approach is somewhat more neat.

Spring Java config, @Autowire vs. Constructor Injection, @Transactional and CGLIBThese both statements come from limitations of Java language. CGLIB uses inheritance to generate the proxy classes, however you can't bypass calling 'super()` constructor methods when creating a subclass instance. Some languages alleviate the probrem, in Google Dart for example classes automatically define interfaces. Another problem is that annotations are not inherited from interfaces, so @Transactional on interfaces does not always work. So these problems are just Java/JVM gotchas.

Sep5

comment

Spring Java config, @Autowire vs. Constructor Injection, @Transactional and CGLIBCreate interface with the same methods that the class has, say void saveSomething(Something a) and inject that interface to the client bean instead of injecting the class instance. The original class(which is registered as Spring bean) will implement that interface, but the client will refer to it via interface. P.S. Leave @Transactional on the implementation of the method, do not move it to interface.

@transactional not working spring 4 hibernate 4I think your FeatureDAO is not a Spring bean => it's not wrapped by Spring AOP => it manages sessions and transactions independently without addressing to Spring transactions. Please add FeatureDAO source code, for this question to be answered.