If we need to customize the object creation process for a few interface types, at that point we would depend on the Guice Provider component. Let’s say, for the NotificationService interface, we need SMSProvider to make and return objects of type SMSService. In such a case, we can authorize the provider type for the interface by specifically explaining it in the interface statement. Consider the following code snippet, NotificationService.java;
@ProvidedBy(SMSProvider.class) public interface NotificationService{
}
//@ProvidedBy is equivalent to toProvider() binding like below,
bind(NotificationService.class).toProvider(SMSProvider.class)