Using JavaLoader as a DI property

As some of you might have seen I have been complaining, no not really, but did come across a problem with the DI of JavaLoader and Java Objects into handlers/models etc.

I have found the problem and think it is working 100% now.

From what I have established so far is that the plugin javaloader is initialised, however it is not actually stored in the server scope until one provides paths for the classes.

The fix for this is as simple as this, in which you will notice that I added the call to setup() and so far I have no problems with this hack. It certainly means that I am able to do what I want to be able to do now.

var dirs = arrayNew(1);

var x = 1;

super.init(arguments.controller);

// Plugin Properties

setpluginName(“Java Loader”);

setpluginVersion(“2.0”);

setpluginDescription(“Java Loader plugin, based on Mark Mandel’s brain.”);

setpluginAuthor(“Luis Majano”);

setpluginAuthorURL(“http://www.coldbox.org”);

// Set a static ID for the loader

setStaticIDKey(“cbox-javaloader-#getController().getAppHash()#”);

// Set up default lib paths by looking at its settings?

if( settingExists(“javaloader_libpath”) ){

dirs = getSetting(“javaloader_libpath”);

// Convert simple location to array format

if( isSimpleValue(dirs) ){ dirs = listToArray(dirs); }

// iterate and classload

for(x=1; x lte arrayLen(dirs); x=x+1){

appendPaths( dirs[x] );

}

}

setup();

return this;