Results 1 to 3 of 3

Thread: Wildcards do not work with ClassPathXmlApplicationContextFactory

  1. #1
    Join Date
    Apr 2010
    Posts
    20

    Default Wildcards do not work with ClassPathXmlApplicationContextFactory

    I am using Spring Batch 2.1.5.RELEASE and I am having a problem with ClassPathXmlApplicationFactory. It seems that it does not like wildcards in the resource path. The following config will not work:

    HTML Code:
    <bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry" />
    
    	<bean id="jobContextFactory" class="org.springframework.batch.core.configuration.support.ClassPathXmlApplicationContextFactory">
    		<property name="resource" value="classpath*:META-INF/spring/batch/jobs/**/*.xml"/>
    	</bean>
    
    	<bean id="jobLoader" class="org.springframework.batch.core.configuration.support.DefaultJobLoader">
    		<property name="jobRegistry" ref="jobRegistry" />
    	</bean>
    						
    	<bean id="jobRegistrar" class="org.springframework.batch.core.configuration.support.AutomaticJobRegistrar">
    		<property name="applicationContextFactories" ref="jobContextFactory"/>
    		<property name="jobLoader" ref="jobLoader"/>
    	</bean>
    However, the following config does work. Notice the path above should find the path below.

    HTML Code:
    <bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry" />
    
    	<bean id="jobContextFactory" class="org.springframework.batch.core.configuration.support.ClassPathXmlApplicationContextFactory">
    		<property name="resource" value="classpath:META-INF/spring/batch/jobs/jobserviceimpl/jobserviceimpl-job-context.xml"/>
    	</bean>
    
    	<bean id="jobLoader" class="org.springframework.batch.core.configuration.support.DefaultJobLoader">
    		<property name="jobRegistry" ref="jobRegistry" />
    	</bean>
    						
    	<bean id="jobRegistrar" class="org.springframework.batch.core.configuration.support.AutomaticJobRegistrar">
    		<property name="applicationContextFactories" ref="jobContextFactory"/>
    		<property name="jobLoader" ref="jobLoader"/>
    	</bean>
    Am I missing something?

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

    Default

    The factory accepts a Resource (singular), and the pattern would resolve to a Resource[] (plural). You would need to supply a single resource with an import to get multiple resources.

  3. #3
    Join Date
    Apr 2010
    Posts
    20

    Default

    Are there any examples of doing that?

Posting Permissions

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