Feb 19th, 2008, 04:32 AM
Setting System Property via spring
I want to set system property in my application via spring config file. I tried to set system property as below but I couldn't be successful.
<bean id="Test" class="java.lang.System" factory-method="setProperty">
Error creating bean with name 'Test' defined in class path resource [config.xml]: Factory method 'setProperty' on class [java.lang.System] returned null.
Can anybody pls let me know how can I handle null bean in a context or any other way to set the system property via config file ( other part can not be changed ).
Although it's not a efficient of doing it, I have no other option.
Last edited by cravi; Feb 19th, 2008 at 08:43 AM.
Feb 22nd, 2008, 12:39 AM
If you really need to do something like this create your own Java class where you do the actual operation. You can instantiate your Java class as usual in the context.
Feb 22nd, 2008, 04:26 AM
thnx Joerg for response,
But I have got so many users of this application,it is really very difficult for me to add anything there. The only thing which I can change is my spring config file.
That's why I am searching anything in spring which can set my system variable.