Announcement Announcement Module
No announcement yet.
Dynamic Loading of Beans (dynamic conext file creator) Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic Loading of Beans (dynamic conext file creator)

    I'm currently writing an application which only knows at startup what (visual) components it will show by reading a config file it gets from another program.

    So it's not possible to have a prewritten context file to wire everything together.

    But what is possible, I think, is to create the context file on the fly and than pass it on to the spring framework.

    My question is: is there a way in spring to do this 'dynamic context file creation' or do I have to write my own 'engine'?



  • #2
    Spring configuration can be entirely created programatically - with the XML file this process happens behind the scenes. For your case, I would advice you to write a custom BeanDefinitionReader that do the appropriate calls to the Spring API.
    Take a look at the javadocs and the sources - Spring provides plenty of base classes so you can implement only what you are interested in.