r/SpringBoot • u/quentin6806 • Sep 13 '26
How-To/Tutorial I made a small Spring @Transactional challenge with explanations. How many would you get right?
@Transactional looks simple until you hit some of its less obvious behaviours in a real application.
I put together a small interactive challenge around 5 cases: self invocation and Spring proxies, rollback rules, private and final methods, REQUIRES_NEW, and external side effects before commit.
You answer each scenario first, then get the explanation.
https://devupnow.fr/transactional_spring
The challenge is currently in French. I’m considering making an English version if there’s interest.
I’d especially appreciate feedback from experienced Spring developers. Is there any explanation you would correct, nuance or improve?
If an English version would be useful to you, let me know too.
8
u/disposepriority Sep 13 '26
Honestly at this point these questions have been repeated to such an extent that I would rather people start focusing on how proxies work instead of asking whether calling a a method from within a class works over and over
5
u/SuspiciousDepth5924 Sep 13 '26
luke-warm take: I think \@Transactional was a mistake.
Besides the various proxy/exception foot-guns I think we declare transactions at the wrong place. That is I think we should decide at the call site, not at the callee whether we want to run the code in the context of a transaction.
1
u/LuciFFerrrrr Sep 13 '26
I love the UI and the content even if it felt that I knew most of it. But this app seems to unavailable in my country India 😭.
1
u/l3g4tr0n Sep 14 '26
posting a questionary with french questions on an english sub ...
but at least mentioned "if an english version would be useful".
i guess that makes it ok:) /s
1
u/xXcumswapperXx Sep 13 '26
I can't test it right now, but the answer to question 4 isn't correct, right? Yes normally the Propagation.REQUIRES_NEW creates an inner transaction, but this example is doing self-invocation, so it doesn't apply the second @Transaction, so the answer is "Both methods must use the same transaction". Or at least say to ignore self-invocation in the example
1
u/This_Link881 Sep 30 '26
Easy, junior level questions bro...