Results 1 to 4 of 4

Thread: Jobparser factory throws exception if AllowBeanDefinitionOverriding set to false

  1. #1
    Join Date
    Apr 2011
    Posts
    2

    Default 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 at 01:51 PM.

  2. #2
    Join Date
    Apr 2011
    Posts
    2

    Default

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

  3. #3

    Default

    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.

  4. #4
    Join Date
    Jun 2007
    Location
    Bratislava
    Posts
    8

    Default

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

Tags for this Thread

Posting Permissions

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