Announcement Announcement Module
Collapse
No announcement yet.
Wildcards do not work with ClassPathXmlApplicationContextFactory Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      Are there any examples of doing that?

      Comment

      Working...
      X