Easy
The following code
public interface AddressResolver{}
@Primary
@Component
public class GoogleMapAddressResolver implements AddressResolver{
}
@Component
public class CustomMapAddressResolver implements AddressResolver{
}
@Service
public class AddressService{
@Autowired
private AddressResolver addressResolver;
}
Author: W3D TeamStatus: PublishedQuestion passed 2216 times
Edit
0
Community Evaluations
5
How is PDO implemented in Spring?14
A bean with a `session` scope is injected into a bean with a` singleton` scope. What happens when the application starts?4
How does Spring match beans?16
Explain the prototype scope in Spring4
The `@Autowired` annotation is a Spring annotation, accepts a parameter allowing to specify if a dependency is optional8
Explain the `session` scope in Spring4
What is the scope of a bean with a `request` scope?