Hi Oleksandr,
We had several a dozen or more applications that use our existing command line argument processing API. This API does validation (e.g., required arguments, type conversion, user help and default values.
Your suggestion is a possible workaround, but it requires rewriting code I didn't want to touch. Fortunately, I have that option.
I think what I may do is convert all the command line arguments to a string, put that in a system property. Then fetch that out, convert back to the args string array and go on from there.
I've seen some other posts here and in other forums basically asking for the same feature: The ability to introduce pre-existing beans into a bean factory/application context.
for example, what about a definition which allows you to specify that a property is an external reference "xref":
Code:
<property name="args" xref="mainArgs">
<constructor-arg xref="mainArgs">
Then, when creating the application context, pass in a Map with the beans:
Code:
public static void main(String[] args)
{
Map map = new HashMap<String, Object>();
map.put("mainArgs", args);
ApplicationContext ctx = new ClassPathXmlApplicationContext(paths, map)
...
}
Has something like this been considered in the past?
Thanks,
-Doug