spring-projects / spring-projects/spring-framework

@Transactional should fail in @PostConstruct if AspectJ transaction aspect not initialized yet

Open
#27,002 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: data type: enhancement
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

Using Aspectj mode with runtime aspectj weaver.

Inside a @PostConstruct, calling a method with @Transactional doesn't start a transaction.
The transactional aspect forwards call to the method, but no transaction is started. This is an invalid behavior, I was expecting an exception.

Sample repo: https://github.com/cdalexndr/spring-boot-issue-26710

Spring Boot 2.4.4

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 linked sample repository and reproduce the behavior on Spring Boot 2.4.4 using AspectJ mode with the runtime weaver. Trace the transaction aspect during @PostConstruct initialization; done means the invalid call no longer proceeds silently and instead raises the expected exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.