Announcement Announcement Module
Collapse
No announcement yet.
Reversing beans into config files Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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).

    Comment


    • #3
      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

      Comment

      Working...
      X