Results 1 to 3 of 3

Thread: Seeting System Property via spring

  1. #1
    Join Date
    Feb 2008
    Posts
    2

    Default Setting System Property via spring

    Hi All,
    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">
    <constructor-arg value="propname"/>
    <constructor-arg value="propvalue"/>
    </bean>

    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.

    thnx
    cravi
    Last edited by cravi; Feb 19th, 2008 at 08:43 AM.

  2. #2
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    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.

    Joerg
    This post can contain insufficient information.

  3. #3
    Join Date
    Feb 2008
    Posts
    2

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •