Results 1 to 3 of 3

Thread: Reversing beans into config files

  1. #1
    Join Date
    Jul 2006
    Posts
    1

    Default Reversing beans into config files

    I'm just using core spring (getBean) to read spring config files into beans. That works fine.

    On the reverse way, I want to save runtime beans into spring config files, so that I can run the corresponding tests again... I miss something like a "setBean" method.

    I am a spring newbie, I searched this forum and read the javadoc, but no hint. So far I understand that this is not the purpose of Spring... However any suggestions on how to make it ? I'm using Spring 1.2.4.
    Jean

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Converting an in-memory spring configuration into some sort of format is not yet supported out of the box. You can add beans to a configuration for example by adding a child application context and then manually registering BeanDefinition (see the javadocs for more info - it should point you in the right direction).
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Dec 2005
    Posts
    269

    Default

    the simpliest way is to serialize you beans with any XML-serializer, like XStream or, even better, java.beans.XMLEncoder/XMLDecoder. That way you can save and restore snapshots of your beans, and you will not need spring for that, which is realy not supposed to do that

Posting Permissions

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