Custom Plugin in aspect

Hey everyone,

First post here.
We are using Coldbox 3.5

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.

Thanks in advance.
Gerhard Davids

Hi Gerhard,

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”;

  1. Map your plugin
    map(“MyCustomPlugin”).toDSL(“coldbox:myPlugin:MyCustomPlugin”);
  2. Inject a provider to it
    property name=“myPlugin” inject=“provider:MyCustomPlugin”)

This will lazy load it and prevent those issues you see.

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Thanks Luis,

I managed to find the same workaround you mentioned in the mean time and it works as expected.

Gerhard