Welcome to the new Spring.io forums!
If this is your first visit, be sure to check out the
by clicking the link above, and for security reasons, use the
forgot password link to reset your password..
You may have to register before you can post: click the register
link above to proceed. To start viewing messages, select the forum that you want to visit
from the selection below.
No announcement yet.
How can I specify default value of @Transactional.timeout?Page Title Module
Isn't it inconvenient?
I should copy and paste it?
Or, should I give up the easiness of <tx:annotation-driven>?
I would agree it is inconvienient, have you checked JIRA to see if there is an issue raised against this? It would be nice to specify defaults and then override them on the annotation. If there isn't an issue raised already might be an idea to raise one!
Its really upto you, do you think theres that much difference using either one. Does the benefits of one, outweigh the other.
One way of saving typing would be to put it at the class level, the other which I'm not so sure about, would be to put it on an interface and then get every service to implement it.
Indeed, but remember that annotating an interface with the @Transactional annotation is not recommended.
The Spring team's recommendation is that you place the @Transactional annotation on the concrete class (or method of a concrete class), as opposed to on any interface(s) that the class may implement. You certainly can place the @Transactional annotation on an interface, but this will only work as you would expect it to if you are using interface-based proxies. Because annotations are not inherited it means that if you are using class-based proxying then the transaction settings will not be recognised by the class-based proxying infrastructure and the object will not be wrapped in a transaction proxy (which would be decidedly bad). So please do take the Spring teams's advice and use the @Transactional annotation on concrete classes.
As to the issue of this thread, sounds like a good improvement. We'll see what Juergen thinks