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

Scoped data container [SPR-16971] #21509

Closed
spring-projects-issues opened this issue Jun 24, 2018 · 1 comment
Closed

Scoped data container [SPR-16971] #21509

spring-projects-issues opened this issue Jun 24, 2018 · 1 comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply

Comments

@spring-projects-issues
Copy link
Collaborator

László Stahorszki opened SPR-16971 and commented

My suggestion would be some kind of a generic data container, whose scope can be parameterized. There could be some annotation, let's say

@ScopedContainer(scope = "some_scope")

that can be applied to fields, or setter methods.

A typical use-case would be, when I want to store some data in a bean of scope singleton, but I need the data List to be session scoped. I could then write a code:

@Component
public class MySingletonBean {

    @ScopedContainer(scope="session")
    private List<String> dataForSession;

    public List<String> getStrings() {
        return dataForSession;
    }
    ...
}

A work around for this feature is creating a generic bean for every scope and using proxy to inject, but I think we could all at some point make use of some feature like this.


No further details from SPR-16971

@spring-projects-issues spring-projects-issues added status: waiting-for-triage An issue we've not yet triaged or decided on type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) and removed type: enhancement A general enhancement labels Jan 11, 2019
@snicoll
Copy link
Member

snicoll commented Sep 19, 2023

Thanks for the suggestion but @Scope is what you should be doing for this.

@snicoll snicoll closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2023
@snicoll snicoll added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 19, 2023
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) status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

2 participants