Announcement Announcement Module
No announcement yet.
Spring Batch Admin : dataSource and transactionManager Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Batch Admin : dataSource and transactionManager

    Spring Batch Admin automatically provides a number of common beans, two of which are: dataSource and transactionManager.
    Is it ok to use these beans within the main application?
    Are there any particular reasons this should be done?
    Are there any particular reasons this should not be done?
    What is the best practice regarding this?
    Thanks in advance.

  • #2

    I would really appreciate it if you could advise on the above issue. I am running WebLogic with Spring Batch Admin and Hibernate.
    I have a set of beans defined via my parent applicationContext.xml called via the web.xml contextConfigLocation setting. These beans are not related to the batch and relate to the core business code. Typically these are beans relating to hibernate and the weblogic transaction manager / jndi lookup for datasource.

    In Spring Batch Admin it defines a dataSource and transactionManager and currently I am importing the standard xml files via my servlet context, i.e. I import

    <import resource="classpath*:/org/springframework/batch/admin/web/resources/servlet-config.xml"/>
    <import resource="classpath*:/org/springframework/batch/admin/web/resources/webapp-config.xml"/>

    But my weblogic transactionManager and dataSource are via the parent context and so they don't override the above in spring admin. I'm also not sure whether spring admin needs to use its own dataSource for updating the spring batch core tables or whether it can just use the weblogic dataSource too.

    Any help with this is very much appreciated, in terms of general advice on how I should setup my configuration with the above in mind. I can import the spring admin beans via my parent applicationContext but is that the right thing to do? I do also have some mvc controllers which I define via annotations through the servlet context. It seems easier to just put everything via the parent context and seperate via files and imports.



    • #3
      Spring Batch Admin allows for the overriding of the standard beans per the documentation here: Basically, you'll configure your beans in the specified location and admin will load them after the provided ones have been loaded so yours will take precedence.


      • #4
        Hi Michael,
        Thanks you very much for your reply. I'll give it a go as suggested.