Overriding bean definition for bean 'X': replacing [Generic bean Y]

przodownikPracy picture przodownikPracy · Sep 26, 2013 · Viewed 15.1k times · Source

I have the configuration like below:

batch:job id="reconciliationJob" job-repository="jobRepository" restartable="true"

and during application context startup I receive something like this in the log:

[INFO] [] [] Overriding bean definition for bean 'reconciliationJob': replacing [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] with [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]

How can I solve this overriding problem?

Answer

Lakatos Gyula picture Lakatos Gyula · Mar 10, 2016

I got the same error. My problem was that I marked the class with @Service then in one of the @Configuration classes I crated a @Bean out of it with the same name as the class.