inject bean from cb cache flakey?

I'm using CB 3 R1. On my OnAppInit I set sever values/objects into
the coldbox cache like this:

getColdBoxOCM().set( 'qStates', utilService.getStates(), 0 );
getColdBoxOCM().set( 'ListOfTaxableItems',
utilService.getItemsWithFee( getSetting('WasteFeeItems') ), 0 );

This works fine and these items and their correct values are all
listed in the CacheBox debug panel.

In my OnSessionStart I set a user bean into sessionstorage with a
composed shoppingcart object. Again this always works fine and as
expected, except that one of the properties that I inject into the
bean is from the cache above and I do so like this:

<cfproperty name="ListOfTaxableItems" inject="ocm:ListOfTaxableItems" /

So here's the problem: the very first time I start up the app,
everything works as planned except a blank string gets injected into
the 'ListOfTaxableItems' property - even though the cachebox debug
panel properly shows the correct string of items in it.

Subsequent sessions all work fine and if I clear all session variables
in the browser and fwreinit the app all work fine. However, on that
initial app startup the very first user created NEVER gets any item
properly injected from the cb cache. To be clear: everything else
gets properly injected, it's just any item coming from the cache gets
set as a blank string.

Although it oughtn't matter, I tried setting those items in my
onDIComplete method instead but I get the same results (first one is
blank string, all others work fine).

Andy

Andy

The problem is a race condition, on session start is spawned by the CF engine in a separate thread and might fire before the on app start fires. So I would try a few things: Move from the app init to an interceptor using the afterAspectsLoad interception point. Try that one first.

I am finalizing the providers in wirebox right now specifically for scope widening issues when dealing with injection from volatile scopes. However, for now, this will be the first thing to try. If not, I can show you how to do a workaround by using a provider method.

Luis F. Majano
President
Ortus Solutions, Corp

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

Thanks Luis - the moving those items to an afterAspectsLoad
interceptor did the trick!