[coldbox-3.5.0] BUG: Aspect not binding with wirebox singletonReload is set to FALSE

I have an aspect that doesn’t seem to bind with singletonReload set to false. When I set it to true it works. Here is my wirebox config for the aspect. I tried with CB 3.1 and 3.5

mapAspect(“VendorMonitor”)
.to("model.aspects.VendorMonitor ");

bindAspect(
classes=match().mappings(“VendorService”),
methods=match().methods(‘save,delete’),
aspects=" VendorMonitor");

Hey guys, has anybody seen this before? Is anyone using the Wirebox AOP in production?

Dustin

Dustin,

We have an app that using aspects in production and I haven’t seen that error before…

Curt

Hmm, very odd. Are you using around, before, or after advices? I'm currently using the around but I'm going to try the before and after advices on monday. Would you be able to post an example of an aspect you're using and how you configure it? Perhaps I'm missing something somewhere.

Dustin

Here is my example of some I am using:

In my Binder:

listeners = [

{class=“coldbox.system.aop.Mixer”}

]

// map the hibernate transaction for contentbox
binder.mapAspect(aspect=“CBHibernateTransaction”,autoBinding=false)
.to(“coldbox.system.aop.aspects.HibernateTransaction”);

// bind the aspect
binder.bindAspect(classes=binder.match().regex(“contentbox.*”),
methods=binder.match().annotatedWith(“transactional”),
aspects=“CBHibernateTransaction”);

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

Ok, I might now what is going on. Is this on handlers you are trying to apply AOP.

I found a bug, with AOP and virtual inheritance with ColdBox.

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

fixed pushed just in time for 3.5 coming soon. can you try against this please.

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 for looking into this Luis. I tried your fix but I’m still experiencing the same issue. I’m not doing AOP with my handlers but rather with my model. Any other ideas?

Dustin

Hey Luis, I’ve got the issue narrowed down to the buildClassMatchDictionary method inside of system.aop.mixer.

It seems that at least part of the issue lies with the following if statement:

// class match? If so, add to dictionary of matched aspects
if( aspectBindings[x].classes.matchClass(arguments.target, arguments.mapping) ){
arrayAppend( matchedAspects, aspectBindings[x] );
}

If I comment out the if statement and always have the aspect appended to the array then the aspect will execute. Although the aspect at least executes, I end up with some extremely strange results. Inside the aspect invokeMethod when I do a dump of the invocation vars (args, target, method, etc) BEFORE the proceed() it dumps the vars for my vendor HANDLER save method. If I do a dump of the invocation vars AFTER the proceed() it dumps the vars of my vendor ENTITY save method. My vendor SERVICE save method never gets executed at all. I inject my VendorService into my entity and handler so perhaps that could have something to do with this problem. Plus, my vendor service, handler, and entity all have save methods (though they all point to the service’s save method).

So in my limited understanding of the CB AOP internals, it seems that the problem may be that CB is having a hard time matching my aspect to my service. But then again, this may not be a CB bug but simply a misconfiguration of something in my application. At this point though I don’t know at all.

Let’s do this. Send me your aspect and bindings. I will recreate with that. But yes we only add to our matching dictionary if classes match if not performance decreases.

The side effect you see is normal as when you proceed other methods execute that can affect the arguments