I wrote a simple aspect that has a custom plugin(autowired) injected
as a property.
When trying to run I get a coldfusion error stating that WIREBOX is
Undefined.
The source of the error is PluginService.cfc line 129.
Which pretty much is :
if( NOT wirebox.getBinder().mappingExists( pluginLocation ) ){
I did a dump of the plugin it was trying to instantiate and it turns
out to be our custom plugin.
Is there anything specific I should be configuring for this to work?
Is it possible to inject custom plugins into aspects at all?
I tried using 'bindAspect' in wirebox.cfc instead of annotating the
aspect but still no joy.
We had this issue already reported to us. I just finally finished the fix for it and is on the development branch now. RC1 for ColdBox 3.5 is only about 2 weeks away, so you can either wait for that official release, or update your core from github or do a workaround.
The issue lies in that the plugin service is not fully configured waiting for WireBox to finalize, but WireBox in its initialization needed a plugin. Chickend and the egg issues.
Workaround:
Inject a plugin provider instead
// the following fails
property name=“myPlugin” inject=“coldbox:myPlugin:MyCustomPlugin”;
Map your plugin
map(“MyCustomPlugin”).toDSL(“coldbox:myPlugin:MyCustomPlugin”);
Inject a provider to it
property name=“myPlugin” inject=“provider:MyCustomPlugin”)
This will lazy load it and prevent those issues you see.