or you got 'Spring finding multiple bean definition error' ?
Its simple.!
You need to use @Qualifier annotation here...!
public class MovieRecommender {
@Autowired
@Qualifier("main")
private MovieCatalog movieCatalog;
// ...
}
and your bean application context configuration will have this.
<context:annotation-config/>
<bean class="example.SimpleMovieCatalog">
<qualifier value="main"/>
<!-- inject any dependencies required by this bean -->
</bean>
<bean class="example.SimpleMovieCatalog">
<qualifier value="action"/>
<!-- inject any dependencies required by this bean -->
</bean>
Now you can switch between two qualifiers when ever you want too..! good luck.
No comments:
Post a Comment