Transactional integration and Spring Boot applications
You can achieve transactional integration when you are developing Spring Boot applications for use with CICS® Liberty. The effect of transactional integration between Spring Boot and CICS is to ensure that the CICS Unit of Work (UOW) is coordinated by Liberty's transaction manager. Using the Java™ Transaction API (JTA) you can coordinate CICS, Liberty, and third-party resource managers, such as a type 4 database driver connection, together as one global transaction. For more information about JTA support in CICS, see Java Transaction API (JTA).
JTA is available for use in a Spring Boot WAR application in various ways:
- Spring Boot's @Transactional annotation: This annotation, which is specified at the class or method level denotes the code segment to be contained within a single global transaction.
- Spring templates: The Spring framework provides two templates for use with programmatic transaction management: the TransactionTemplate and the PlatformTransactionManager interface.
- UserTransaction: It is also possible to use the JTA UserTransaction interface within a Spring
Boot application by obtaining the UserTransaction initial context of the hosting Application server
(Liberty) through a JNDI lookup. For example,
ctx.lookup("java:comp/UserTransaction");
. The developer can employ a Bean-managed approach to transactions by explicitly coding UserTransaction 'start' and 'end' calls around the resources to be managed.