Results 1 to 7 of 7

Thread: batch admin - context:property-placeholder into job

  1. #1

    Default batch admin - context:property-placeholder into job

    Hi,

    I m trying to define a new job into batch admin. I put my configuration under "src/main/resources/META-INF/spring/batch/jobs" and all work fine.
    As soon i try to define placeholder (for example ${my-variable}) into the file i m not able to resole the properties. I tried to define contextroperty-placeholder location, but no luck. There is a "default" location defined where the properties for jobs should be ?

    Tnx

  2. #2
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    There is a placeholder in the parent context, but I recommend you just define your own app-specific one.
    Code:
    <context:property-placeholder/>
    should work fine (did you declare the namespace properly?).

  3. #3

    Default

    Hallo,

    I think namespace is ok, but still can't resolve placeholder.

    here is my config

    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:batch="http://www.springframework.org/schema/batch"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    		http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    
    	<context:annotation-config />
    	
    	<context:property-placeholder location="classpath*:batch-myproperties.properties"/>
     	
    ....
    and the error

    Code:
    org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'processMsgFromInDirectory' defined in file [C:\local\develop\workspace-sts-2.5.1.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\simpleBatchWithAdmin\WEB-INF\classes\META-INF\spring\batch\jobs\egateway.xml]: Could not resolve placeholder 'file.storage.indir'
    	at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:287)

  4. #4
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    I get it. There's a bean in the parent context with ignoreUnresoolvablePlaceholders=false, and that bean is copied into your job context by the registrar. It fires before your custom one (by accident essentially since they both have the same priority by default). You should set your configurer bean to have order=0 (or anything less than Ordered.LOWEST_PRIORITY)..

  5. #5

    Default

    Still no luck,

    I trieied with
    Code:
    <context:property-placeholder location="classpath*:batch-myproperties.properties" order="0"/>
    but no luck.

    reading http://static.springsource.org/sprin...EST_PRECEDENCE seem to me that should work, but for some reasons the parent placeholder overwrite my one.

    I found a workaround, by using the name "batch-default.properties" for the properties of my job. Is not nice but it work.

    Would be nice to have something like
    Code:
    <property name="locations">
            <list>
                    <value>classpath:/org/springframework/batch/admin/bootstrap/batch.properties</value>
                    <value>classpath:batch-default.properties</value>
                    <value>classpath:batch-${ENVIRONMENT:hsql}.properties</value>
                    <value>classpath*:/META-INF/spring/batch/jobs/*.properties</value>
            </list>
    </property>
    into configuration of parent PropertyPlaceholderConfigurer (spring-batch-admin/spring-batch-admin-manager/src/main/resources/META-INF/spring/batch/bootstrap/manager/env-context.xml), to set placeholder for every jobs

  6. #6
    Join Date
    Mar 2011
    Location
    Johannesburg, South Africa
    Posts
    4

    Default

    I had the same problem and I ended up adding all my properties in the batch-{databasetype}.properties which is not an ideal solution, but works...

  7. #7
    Join Date
    Mar 2011
    Location
    Sfax
    Posts
    8

    Default Is there a French version of spring batch admin ?

    I want a copy of Spring Batch Admin French Language. If it's not exist, I need the Source code to develop my own copy in French. It is possible or not?
    thanks
    =)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •