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

Clarify recommendation on self-injection for legitimate use cases (e.g. @Transactional re-entrant calls) #28299

Closed
jonenst opened this issue Apr 7, 2022 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: documentation A documentation task
Milestone

Comments

@jonenst
Copy link

jonenst commented Apr 7, 2022

Hi,
It is becoming harder and harder to use self-injection:

There are probably more small issues like this. However, unlike more general dependency cycles, self-injection seems to be considered a legitimate strategy for some use cases (e.g. @Transactional, @Cacheable re-entrant calls ) by many.

spring-projects/spring-boot#27652 (comment) recommended to raise an issue to the framework team.

Is there an official documented strategy and list of legitimate use cases for self-injection ? #27534 (comment) for example recommends @Lazy.
Or are there other implementation strategies that can be used to replace self-injection in these use cases?
My personal interest is purely reentrant calls from service beans on @Transactional methods.

This issue could be used to track documentation fixes to clarify these common use cases.

Thanks in advance

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 7, 2022
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Apr 25, 2022
@sbrannen sbrannen changed the title Clarify recommendation on self injecting for legitimate use cases (e.g. @Transactional re-entrant calls) Clarify recommendation on self-injection for legitimate use cases (e.g. @Transactional re-entrant calls) Nov 12, 2023
@snicoll snicoll added type: documentation A documentation task and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 22, 2023
@snicoll snicoll added this to the 6.1.x milestone Nov 22, 2023
@jhoeller jhoeller modified the milestones: 6.1.x, 6.1.3 Dec 18, 2023
@jhoeller jhoeller modified the milestones: 6.1.3, 6.1.4 Jan 10, 2024
@snicoll snicoll removed their assignment Feb 14, 2024
@bclozel bclozel changed the title Clarify recommendation on self-injection for legitimate use cases (e.g. @Transactional re-entrant calls) Clarify recommendation on self-injection for legitimate use cases (e.g. @Transactional re-entrant calls) Feb 14, 2024
@jhoeller jhoeller modified the milestones: 6.1.4, 6.1.x Feb 14, 2024
@jhoeller jhoeller modified the milestones: 6.1.x, 6.1.7 May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

5 participants