Is there any performance penalty to define all methods as transactional using Spring AOP based declarative transaction management? See the config below. The reason is that I do not know what method name developers will give for non transactional methods. One option is I start with a wild card list and developers update the list if the method name does not fall under the defined list.
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="dtxops" expression="bean(*Service)" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="dtxops" />
</aop:config>
It depends on what underlying transaction manager you are using. The default spring “transaction per thread, no XA transactions” probably doesn’t have a any penalty. If you are using JBoss with the XA transaction manager, then it will write some data to a transaction log .
— original — Even then, I think you’d find the performance penalty to be fairly small.
— edited — In my experience, I haven’t seen a huge increase in performance when converting to Readonly using the JBoss transaction manager. Per the comment below, at least one user saw a 30% performance increase which is significant.