-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Regression with poolTargetSource and scoped proxy [SPR-15042] #19608
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
Comments
Juergen Hoeller commented Janne Valkealahti, what is this setup trying to accomplish to begin with? A request-scoped |
Janne Valkealahti commented This is coming from my Spring Statemachine samples which originated from a question - "If using machines in a controller methods how can you avoid instantiation of a machine(which is relatively expensive) with every request and re-use a pooled set of machines with a request scope". StateMachineConfig What I did in that sample was only way to get pooling working. Thought, if there is better way to accomplish same logic I'd also be fine to change my sample. |
Juergen Hoeller commented Well, what the above code actually declares is a request-scoped proxy object (or even worse, a request-scoped proxy factory object) which - for every method invocation - grabs a fresh object from the target pool to delegate to, releasing it right after each method call. You'll have a per-request proxy object but you won't get any request-specific state or other benefit out of such a request-scoped proxy, as far as I can see, so you could just drop that scoping at the proxy level and use a plain shared proxy to the pool. If you rather need a stateful instance from the pool associated for the lifetime of a request, then such AOP That said, I'm still researching where we got a regression here: I suppose we previously simply accepted to scope the |
Janne Valkealahti commented Thanks for clarifying this, I always felt that I might have been doing something stupid in that sample. I'll play with those ideas you wrote! |
Juergen Hoeller commented This turns out to be another side effect of the change behind #19382, along with #19458. Fixed for 4.3.6 now. My recommendation still stands that the scenario is flawed :-) Nevertheless, such a setup should start up cleanly which it does again. |
Janne Valkealahti commented Thanks a lot! Now my stuff builds fine on latest framework/boot snapshots. I'll definitely get that sample fixed for something better. |
Uh oh!
There was an error while loading. Please reload this page.
Janne Valkealahti opened SPR-15042 and commented
It seems that this which is pretty much straight from docs works with 4.3.3 but not with 4.3.4, 4.3.5 or 5.0.0.BUILD-SNAPSHOT.
Affects: 4.3.4
Reference URL: spring-attic/spring-framework-issues#144
Issue Links:
The text was updated successfully, but these errors were encountered: