Caleb Cushing opened SPR-17158 and commented

so one of the problems, I'm looking at with logging, is the idea, that a request doesn't imply a transaction, and a transaction doesn't imply a request. I'd like to have my scope eagerly instantiated if either begins, the ideally they would share that bean until the last scope ended. That might be hard though... might be easier to create a different bean for each scope.

@Bean
 @Scope("transaction")
 @Scope("request")
 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;
 }

Issue Links: - #21694 eager @Scoped beans

Comment From: snicoll

Thank you for the suggestion and sorry for the delay. Having links between scope introduces would introduce a significant complexity in the implementation that we can't justify, given the lack of interest.