Announcement Announcement Module
Collapse
No announcement yet.
Jobparser factory throws exception if AllowBeanDefinitionOverriding set to false Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jobparser factory throws exception if AllowBeanDefinitionOverriding set to false

    I try to create a job as so (using spring-batch 2.1.7.RELEASE and spring 3.0.5.RELEASE):
    Code:
     	<batch:job id="someJob" job-repository="jobRepository">
      		<batch:step id="aStep">
      			<batch:tasklet>
            		<batch:chunk reader="itemReader" writer="itemWriter" commit-interval="5"/>
        		</batch:tasklet>
        	</batch:step>
    	</batch:job>
    In this project the ApplicationContext does not allow beans to be overidden so AllowBeanDefinitionOverriding is false (i can't change this). This doesn't work as i get the exception:

    Code:
    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: 
    Configuration problem: Invalid bean definition with name 'someJob' defined in null: 
    Cannot register bean definition [Generic bean: class [org.springframework.batch.core.configuration.xml.JobParserJobFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] for bean 'someJob': 
    There is already [Generic bean: class [org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] bound.
    in org.springframework.beans.factory.support.DefaultL istableBeanFactory, line 460.

    It seems that the JobParser first registers a bean with id 'someJob' with a bean definition SimpleFlowFactoryBean and then tries to override it with a JobParserJobFactoryBean.

    Has anyone seen this or is there a way around it?

    Thanks,
    Last edited by asmalik; Apr 6th, 2011, 01:51 PM.

  • #2
    Anyone? Is this a bug? Does it mean that if allowBeanDefinitionOverriding is set to false, i cannot use the JobParser?

    Comment


    • #3
      When I run a job, every single bean gets overridden. have not dug down to see why, so not sure where to help you.

      Turn the property to "true", then breakpoint when they are getting overridden and see why spring is doing it.

      Comment


      • #4
        It is a bug in my opinion. I have created an issue for this: https://jira.springsource.org/browse/BATCH-1863

        Comment

        Working...
        X