Fix transaction managemement snippet and documentation

Closes gh-36323
This commit is contained in:
Sébastien Deleuze
2026-03-09 10:29:45 +01:00
parent b2a4bc8900
commit eeddf9a73a
8 changed files with 86 additions and 28 deletions
@@ -89,34 +89,12 @@ annotation in a `@Configuration` class. See the
{spring-framework-api}/transaction/annotation/EnableTransactionManagement.html[javadoc]
for full details.
The following examples show the configuration needed to enable annotation-driven transaction management:
The following example show the configuration needed to enable annotation-driven transaction management:
[tabs]
======
Java::
+
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
----
include-code::AppConfig[]
----
Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
----
include-code::AppConfig[]
----
XML::
+
[source,xml,indent=0,subs="verbatim,quotes",role="secondary"]
----
include-code::annotations-tx[tags=snippet]
----
======
include-code::./AppConfig[tag=snippet,indent=0]
TIP: In programmatic configuration, the `@EnableTransactionManagement` annotation uses any
`PlatformTransactionManager` bean in the context. In XML configuration, you can omit
`TransactionManager` bean in the context. In XML configuration, you can omit
the `transaction-manager` attribute in the `<tx:annotation-driven/>` tag if the bean
name of the `TransactionManager` that you want to wire in has the name `transactionManager`.
If the `TransactionManager` bean has any other name, you have to use the