How to pass values to a constructor that robotlegs intantiates
What I want to do: Pass 2 string arguments to a constructor.
I have a service in one flex app ( a MessagingService) that I'd
like to render a little more generic and use in multiple apps.
Currently its constructor has no arguments and as it is only in one
app, the specific values I need for message filtering (selector
determintation/destination) are hard coded in the constructor.
What I'm hoping to do is pass the 2 string variables I need to the constructor as part of the mapSingleton or add mapvalues but it is not clear that I can do this or that it is the right way to do it.
Is there a preferred way to pass constructor args (in this case 2 strings) while still having robotlegs handle instantiation. I've poked around in the knowledge base but haven't found anything.
Thanks
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Joel Hooks on 03 Jun, 2011 03:49 PM
Two strings is going to be really tough (well, nigh impossible) to pass in
through the constructor. You *CAN* pass in constructor arguments, but the
arguments need to be managed injectable objects. My suggestion would be to
create a VO/Model that has the string values as properties. Configure that
object with your string values and add its type as a parameter in the
constructor of your service.
matthias.howell closed this discussion on 03 Jun, 2011 05:49 PM.