transaction

Define Spring transaction propagation, isolation, rollback, and read-only routing rules.

Updated Jan 11, 2026
One-click install
npx skills add https://github.com/gykk16/spring-skeleton --skill transaction-gykk16
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: transaction
Source: https://github.com/gykk16/spring-skeleton/tree/main/.omc/skills/transaction
Command: npx skills add https://github.com/gykk16/spring-skeleton --skill transaction-gykk16

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides clear guidelines and best practices for managing database transactions in Spring applications, preventing common issues and ensuring data integrity.

Core Features & Use Cases

  • Transaction Management: Understand and apply propagation levels, isolation levels, and rollback rules.
  • Master/Slave Routing: Learn how Spring automatically routes read-only operations to slave databases.
  • Pitfall Avoidance: Identify and resolve common transaction pitfalls like self-invocation and external I/O within transactions.
  • Use Case: Ensure that critical financial operations are atomic and consistent, or that read-heavy reporting queries efficiently utilize read replicas.

Quick Start

Use the transaction skill to understand the default propagation level for @Transactional annotations.

Frequently Asked Questions about transaction

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure Spring transaction propagation and isolation levels?

Configure Spring transaction propagation and isolation levels using the @Transactional annotation to define database transaction boundaries and ensure data integrity. This Skill provides rules for selecting appropriate propagation behaviors and isolation settings.

Why does my Spring @Transactional rollback not work for self-invocation?

Spring @Transactional rollback fails during self-invocation because proxy-based AOP intercepts external calls. This Skill identifies common transaction pitfalls like self-invocation and external I/O within transactions, providing guidance to resolve them.

How does Spring route read-only transactions to a Master/Slave database?

Spring routes read-only transactions to slave databases by checking the transaction read-only status via DataSource routing. This Skill explains how Master/Slave routing automatically directs read-heavy reporting queries to read replicas.

When should I use Spring transaction timeouts and avoid external calls?

Use Spring transaction timeouts to limit execution duration and avoid external calls to prevent database connection exhaustion. This Skill provides guidance on handling external I/O within transactions and setting appropriate timeout constraints.

What is the default propagation level for Spring @Transactional?

The default propagation level for Spring @Transactional is REQUIRED, joining an existing transaction or starting a new one. This Skill helps you understand default propagation behaviors to ensure critical operations are atomic and consistent.