Results 1 to 2 of 2

Thread: changing object factory property at runtime

  1. #1

    Default changing object factory property at runtime

    I have a client factory Spring bean defined as a singleton which includes a property called disabled. On startup of the app if the property is set to true, then the object factory will skip initializing and just return a null object.

    My question is how can I accomplish changing the "disabled" property at runtime and have the factory create a client and vise versa? The goal here is to enable/disable the factory (and the client it initializes/reinitializes) without restarting the application. I have the disabled property defined/injected via contextroperty-placeholder.

    Here's a gist of the factory in question: https://gist.github.com/1627584

    Thanks.
    Last edited by digitalsanctum; Jan 17th, 2012 at 11:20 AM.

  2. #2
    Join Date
    Apr 2008
    Location
    Seville, Spain
    Posts
    132

    Default

    I'm not sure if I understand you but...

    FactoryClientTransport fct = ctx.getBean("fct");
    fct.setEnabled(true);
    fct.afterPropertiesSet( );

    Cheers
    Jose Luis Martin
    Freelance Senior Consultant
    JDAL - Java Database Application Library

Posting Permissions

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