Announcement Announcement Module
No announcement yet.
Spring Batch Admin: default property value in PropertyPlaceholderConfigurer Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Batch Admin: default property value in PropertyPlaceholderConfigurer

    There is a <value>classpath:batch-${ENVIRONMENT:hsql}.properties</value> in the PropertyPlaceholderConfigurer bean from spring-batch-admin-manager-1.2.0.RELEASE.jar/META-INF/spring/batch/bootstrap/manager/env-context.xml, but if i understand srping docs correctly, PropertyPlaceholderConfigurer does not support default values, from Example: the PropertyOverrideConfigurer:

    The PropertyOverrideConfigurer, another bean factory post-processor, resembles the PropertyPlaceholderConfigurer, but unlike the latter, the original definitions can have default values or no values at all for bean properties
    I'm asking because when i run the admin with 'default' config, i.e. override folder is empty, it fails with

    org.springframework.beans.factory.BeanDefinitionSt oreException: Invalid bean definition with name 'dataSource' defined in URL [jar:file:/home/et0485/.m2/repository/org/springframework/batch/spring-batch-admin-manager/1.2.0.RELEASE/spring-batch-admin-manager-1.2.0.RELEASE.jar!/META-INF/spring/batch/bootstrap/manager/data-source-context.xml]: Could not resolve placeholder 'batch.jdbc.driver'
    and the in debug i see that SystemPropertyPlaceholderResolver.resolvePlacehold er receives "ENVIRONMENT:hsql" and obviously can't find it since property name is ENVIRONMENT.

    Am i missing something or it's a bug?

    Best regards, Eugene.

  • #2
    I am having a heck of a time getting past this. I have found nearly none of the admin setup works as advertized, and I am working within STS. I have had to setup maven to include the dependencies to get the app to run at all, and now it does not load its own properties and I can see how to get it to override at this point. The documentation assumes a lot!

    Did you have any luck on getting past this?


    • #3
      In order to run spring-batch-admin it expects a variable named ENVIRONMENT to be set. For example in order to run jetty in the examples you need to use
      mvn jetty:run -DENVIRONMENT=h2
      Spring batch admin uses this var to setup the datasource dynamically. For instances you are able to set mysql, h2, etc.

      See ~ Environment Settings.


      • #4
        I think you can get away with not using ENVIRONMENT, as per this excerpt from env-context.xml:

        It will default to, which you need to put in your classpath.

        Still, if you have issues, override all of it. This is how I did it: I put a copy of env-context.xml in META-INF/spring/batch/override/manager/ and then added another entry in the property placeholder:

        And then I also override the following in