Reputation: 547
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?
Upvotes: 16
Views: 18040
Reputation: 4160
I got the same error. My problem was that I marked the class with @Service
then in one of the @Configuration
classes I created a @Bean
out of it with the same name as the class.
Upvotes: 7
Reputation: 21866
I experienced something similar and I just changed the name of the class and it worked. Still can't figure out why. I'll update if I understand it better.
But start with changing the bean's class name.
Upvotes: 1
Reputation: 11
I had a similar problem and I resolved it using dependency:analyze
in run maven -> goals. I found unused dependencies in my pom and I removed the unused dependencies.
Note: take care when removing the dependencies because the result of dependency:analyze
it is not secure .
Upvotes: -2
Reputation: 15090
This happens when Spring parses the same applicationContext.xml
twice.
This can happen when for example your have duplicate/overriding <context-param>
imports in your WEB.xml
.
To solve the issue leave only the root applicationContext.xml
there and remove the children.
Upvotes: 4
Reputation: 18413
This is not an error, is only an [INFO] and is a substitution done by Spring; you can see something similar about "step" scoped beans.
For example, if you have a bean marked as
<bean id="myBean" class="path.to.beanClass" scope="step" />
this will be replaced by a bean with name scopedTarget.myBean
.
Lookup at StepScope doc and source
Upvotes: 3