Issues
3 of 3
Wirebox - add onInjectorMissingDependency event
Fixed
Description
Pinned fields
Click on the next to a field label to start pinning.
Details
Details
Details
Sentry
Sentry
Sentry
Created December 1, 2019 at 8:38 PM
Updated March 4, 2023 at 4:34 PM
Resolved March 4, 2023 at 4:34 PM
Activity
Show:
Brad WoodDecember 2, 2019 at 7:29 PM
Moved to the WireBox project
A new event called
onInjectorMissingDependency
is now registered in Wirebox. It will be called whenever a dependency cannot be located. Thedata
will also include the following:name
- The name of the requested dependencyinitArguments
- The init arguments if passedtargetObject
- The target object that requested the dependencyinjector
- The injector in use building the dependencyIf you return in the
data
struct an element calledinstance
we will return that back as the dependency, else the normal exception will be thrown.Motivation:
I want to use modules in a legacy app. Several of these modules have dependencies on ColdBox for things like interceptors etc. As I'm in the context of a legacy app I would like to be able to use a convention-based bean factory hook which will be called when a dependency is not found.
My thought here is that in the Custom Binder you could have a onMissingDependency method which is called whenever the autowire fails to find a dependency. Something like this:
Hope this is the right place to log this