Announcement Announcement Module
Collapse
No announcement yet.
AutomaticJobRegister Loader issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AutomaticJobRegister Loader issue

    We are having batch.xml which has imports of all the job xmls and beans which are related to the job. When i use normal way of loading i don't see any issues. But if i use AutomaticJobRegistrar I am getting object un-initialized exception.
    Because in spring xml the beans are having init-method
    <bean id="employee" class="org.test.Employee"
    init-method="init" />


    Normal way of loading
    Code:
    <bean id="jobLoader" class="java.lang.String" />
    AutomaticJobRegistrar
    Code:
    <bean id="jobLoader" class="org.springframework.batch.core.configuration.support.AutomaticJobRegistrar">
    <property name="applicationContextFactories">
    <bean class="org.springframework.batch.core.configuration.support.ClasspathXmlApplicationContextsFactoryBean">
    <property name="resources" value="classpath*:/META-INF/spring/batch/jobs/**/*.xml" />
    </bean>
    </property>
    <property name="jobLoader">
    <bean class="org.springframework.batch.core.configuration.support.DefaultJobLoader">
    <property name="jobRegistry" ref="jobRegistry" />
    </bean>
    </property>
    </bean>
    
    <bean class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor"
    p:jobRegistry-ref="jobRegistry"/>
    What is the issue? How the context is initialized?
    What is the order of spring context loader?

    Thanks in Advance...

  • #2
    Here is what I have in my Spring Batch application:


    Code:
    <bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry" />	
    
    <bean id="automaticJobRegistry" class="org.springframework.batch.core.configuration.support.AutomaticJobRegistrar">
    	<property name="applicationContextFactories">
    		<bean class="org.springframework.batch.core.configuration.support.ClasspathXmlApplicationContextsFactoryBean">
    			<property name="resources" value="classpath*:/META-INF/spring/*-module-context.xml" />
    		</bean>
    	</property>
    	<property name="jobLoader" ref="jobLoader"/>
    </bean>
    
    <bean id="jobLoader" class="org.springframework.batch.core.configuration.support.DefaultJobLoader">
    	<property name="jobRegistry" ref="jobRegistry" />
    </bean>

    Hope this helps,

    Jeff

    Comment


    • #3
      Still I have the same issue

      Comment

      Working...
      X