Announcement Announcement Module
Collapse
No announcement yet.
Instead of XML - Database Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Instead of XML - Database

    Hello,
    Is there any way to get the context i.e. spring - bean configuration from the database instead of the xml files.
    By this I mean, can I have something
    Code:
    context =new %ApplicationContext%(Object xml,parent);
    Where Object xml is some kind of object that has wiring of all the bean (i.e. in footballJob.xml) retrieved from database

  • #2
    That kind of question belongs more in the Core forum and in fact has been asked and answered a couple of times.

    Thread list #1
    Thread list #2
    Last edited by Marten Deinum; Jan 21st, 2008, 01:44 AM. Reason: Added searches

    Comment


    • #3
      Please see the links in the previous response for instructions on loading a complete application context from the database.

      However, as specifically applied to Spring Batch, there is a slightly simpler solution. Instead of putting the entire context in the database, you could implement a JobRegistry (since it is only an interface) in your main application context (e.g. the simple-container-definition.xml in samples) that reads from a database, creates a Job configuration bean within that context and wires it.

      At this moment, the only JobRegistry implementation included in Spring Batch is the MapJobRegistry, which stores jobs in memory. This depends on the JobRegistryBeanPostProcessor to take all Job objects in the application context and add them when during initialization. If you replaced this with a database registry, you would also need to write a launcher (along the lines of BatchCommandLineLauncher) that did not expect a file name.

      As for inclusion in the framework you may want to add it to the JIRA: http://jira.springframework.org/browse/BATCH

      Comment

      Working...
      X