Skip to content

Allow any @Transactional propagation for @TransactionalEventListener with BEFORE_COMMIT phase#35150

Closed
carsago wants to merge 2 commits into
spring-projects:mainfrom
carsago:feature/skip-propagation-check-for-before-commit-phase
Closed

Allow any @Transactional propagation for @TransactionalEventListener with BEFORE_COMMIT phase#35150
carsago wants to merge 2 commits into
spring-projects:mainfrom
carsago:feature/skip-propagation-check-for-before-commit-phase

Conversation

@carsago

@carsago carsago commented Jul 3, 2025

Copy link
Copy Markdown

Following discussions in #30679 and #31414, validation was added to restrict @TransactionalEventListener to only use @Transactional(propagation = Propagation.REQUIRES_NEW) or @Transactional(propagation = Propagation.NOT_SUPPORTED).

However, this validation is unnecessary when the @TransactionalEventListener phase is BEFORE_COMMIT (excluding propagation NEVER). While removing the @Transactional would solve the issue, this creates unnecessary friction when upgrading Spring versions.

carsago added 2 commits July 3, 2025 20:07
Signed-off-by: carsago <ohseo8813@gmail.com>
Signed-off-by: carsago <ohseo8813@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 3, 2025
@jhoeller jhoeller added in: data Issues in data modules (jdbc, orm, oxm, tx) type: regression A bug that is also a regression and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jul 28, 2025
@jhoeller jhoeller added this to the 6.2.10 milestone Jul 28, 2025
@jhoeller jhoeller self-assigned this Aug 1, 2025
jhoeller added a commit that referenced this pull request Aug 1, 2025
@jhoeller

jhoeller commented Aug 1, 2025

Copy link
Copy Markdown
Contributor

Good point! I've implemented this a bit differently, instantiating the listener first and then taking the phase from it for validation purposes. Thanks for the PR, in any case!

@github-actions

github-actions Bot commented Aug 1, 2025

Copy link
Copy Markdown
Contributor

Fixed via da13a24

@github-actions github-actions Bot closed this Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: data Issues in data modules (jdbc, orm, oxm, tx) type: regression A bug that is also a regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants