Correctness15 - SpotBugsExtensionForSpringFrameWork/CS5098 GitHub Wiki
(Suitable) Bug Name
Description
The dependency cannot be resolved when there's more than one bean that satisfies it.
// UnsatisfiedDependencyException occur
@Repository
public class DressRepository implements InventoryRepository {
}
Solutions
@Qualifier("dresses")
@Repository
public class DressRepository implements InventoryRepository {
}
-----------------------------------------------------------------
@Qualifier("shoes")
@Repository
public class ShoeRepository implements InventoryRepository {
}
-----------------------------------------------------------------
public PurchaseDeptService(@Qualifier("dresses") InventoryRepository repository) {
this.repository = repository;
}