Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document behaviour of @Transactional in reactive environments with non-reactive signatures #23277

Closed
michael-simons opened this issue Jul 11, 2019 · 2 comments
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: documentation A documentation task
Milestone

Comments

@michael-simons
Copy link
Contributor

michael-simons commented Jul 11, 2019

Given a scenario with a ReactiveTransactionManager in the context, I expected methods annotated with @Transactional handled by this transaction manager.

However, only methods exposing some sort of reactive API (Flux, Mono and related) are handled via TransactionAspectSupport.

So given a component like

static class Foobar {

	@Transactional
	public void boom() {

	}

	@Transactional
	public Mono<Void> imFine() {
		return Mono.empty();
	}
}

would effectively need two transaction managers, or at one of the methods will fail. With only a reactive transaction manager, boom fails:

java.lang.IllegalStateException: Specified transaction manager is not a PlatformTransactionManager:

While boom is probably not a method that can be used in a sensible way in a reactive context, it's something that's gonna happen eventually and should be at least documented.

As I don't have a good idea, what else to use to decide about which transaction manager to use, I try not to suggest making it work in another way, but just be very clear in the docs about what to expect.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 11, 2019
@michael-simons
Copy link
Contributor Author

Adding this in a good way would also explain easy and fast why @Transactional on a @Test is always imperative.

@sbrannen sbrannen added the type: documentation A documentation task label Jul 11, 2019
@sbrannen sbrannen changed the title Document the behaviour of At-Transactional in reactive environments with non-reactive signatures. Document the behaviour of @Transactional in reactive environments with non-reactive signatures Jul 11, 2019
@sbrannen sbrannen changed the title Document the behaviour of @Transactional in reactive environments with non-reactive signatures Document behaviour of @Transactional in reactive environments with non-reactive signatures Jul 11, 2019
@rstoyanchev rstoyanchev added the in: data Issues in data modules (jdbc, orm, oxm, tx) label Nov 10, 2021
@jhoeller jhoeller removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 25, 2023
@jhoeller jhoeller added this to the 6.x Backlog milestone Nov 25, 2023
@jhoeller jhoeller self-assigned this Dec 26, 2023
@jhoeller jhoeller modified the milestones: 6.x Backlog, 6.1.3 Dec 26, 2023
@jhoeller
Copy link
Contributor

The exception is already different and more expressive now than above: "Cannot apply reactive transaction to non-reactive return type [void] with specified transaction manager: ..." - I'll also add corresponding documentation notes for @Transactional.

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: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

5 participants