spring-projects / spring-projects/spring-framework

Pluggable Functional Transaction Management

Open
#35,441 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: data status: waiting-for-triage
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

I would like to request a registrable, generic approach for functional declarative transaction management as an alternative to throwing exceptions, similar to how Vavr's Try type is currently supported.

Currently, Spring Framework provides special support for Vavr's Try type for declarative transaction management:

While I prefer expressing failure states through types rather than throwing exceptions, I don't want to depend on Vavr. I would like to achieve similar transactional behavior using:

  • My own custom Try type implementation
  • Other functional types that represent success/failure states like Result<T, E> or Either<L, R>

Could we introduce a pluggable interface (similar to a VavrDelegate) that can be implemented and registered to handle custom functional types for transaction management?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Vavr-specific handling in spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java and read the linked declarative transaction documentation. Determine the extension and registration requirements for custom success/failure types; done means the approach is specified well enough to support types such as Try, Result, or Either without requiring Vavr.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.