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

eager @Scoped beans [SPR-17157] #21694

Open
spring-projects-issues opened this issue Aug 9, 2018 · 0 comments
Open

eager @Scoped beans [SPR-17157] #21694

spring-projects-issues opened this issue Aug 9, 2018 · 0 comments
Labels
in: core status: waiting-for-triage

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Aug 9, 2018

Caleb Cushing opened SPR-17157 and commented

I tried this, but including the autowired HttpServletRequest

@Bean
@RequestScope
static CloseableThreadContext.Instance requestContext(
    @Value( "${dex.environment}" ) String env,
    String hostname
)
{// spring will close
    CloseableThreadContext.Instance ctx = CloseableThreadContext.put( "env", env );
    ctx.put( "hostname", hostname );
    return ctx;
}

was thinking that I could simply propagate the context with with it, I then tried adding @Lazy(false) to the definition, but it still didn't instantiate object until I fetched, and called a method on it.

I would like a way to say @Eager on scoped beans (note: this example has @RequestScope but I was also trying to do it with a registered/known working SimpleTransactionScope and SimpleThreadScope

I don't want that to be the default behavior for scoped beans, just an option to create them as soon as scope comes into being.


Issue Links:

@spring-projects-issues spring-projects-issues added status: waiting-for-triage type: enhancement in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: enhancement label Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: waiting-for-triage
Projects
None yet
Development

No branches or pull requests

1 participant