Lightwire - Dynamically passing to the init() on call getBean

Hi there,

I can't seem to find anything about this online so hope this is the
right place to ask :slight_smile:

Is there a way with Lightwire that I can dynamically pass an argument
when the bean is called?

Scenario I have is I've got an Array Iterator and I want to pass in
the array on init().

Call the getPlugin('ioc') or getBean doesn't seem to give me any
option to do that.

As a workaround for now I've setup a new method called setArray() and
I'm passing it into that after I've called in the object. Not the way
I would do it if I wasn't using Lightwire but hey :-).

Any help appreciated.

Cheers,
James

Hi James,

There is no way to do this right now via coldspring, or lightwire. You can however, via Model Integration, tell the getModel() call to NOT execute the init via the executeInit=false argument.

In the next release, once wirebox 1.0 is done, you will be able to pass in constructor arguments via the retrieval call like this:

injector.getInstance(‘MyService’,{arg1=value,arg2=value});

This will take the constructorArgs argument and pass it through to the constructor, much more elegant.

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

Cheers for the reply again Luis.

Definitely..... when can I get my hands on it :smiley: