Question from the Spring test

How to inject a primary bean in Spring

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 2123 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!