Replies: 1 comment
-
Implemented in #81 . Further discussion should happen in #80 . |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe it.
Dynamic bindings have an unknown runtime cost to resolve. If you're making a lot of requests to the container with a dynamic binding in transient or request scope then that could add up quickly.
Describe the solution you'd like.
Add a warning log for any calls to
Binder.toDynamicValue
which haven't had an explicit call to one of the methods inBindingScope
. This would encourage developers to think about what scope they are using for dynamic bindings, many of which could have non-trivial performance impacts. By adding an explicit scope you would be opting out of the warning so it's a relatively low friction way of prodding people in the right direction.Describe alternatives you've considered.
We could implement this in the type system to force a scope for dynamic bindings, but I feel like that might be more confusing than helpful.
Any additional context you'd like to provide?
One situation in particular that I'm considering is the situation where you might spin out child containers on a per-request basis to resolve things needed for that request. In that situation, any dynamic bindings which are resolved for each container request may be adding a lot of unnecessary overhead to every application request.
Beta Was this translation helpful? Give feedback.
All reactions