ImplementedBy

This annotation focuses on a class object that gives an implementation to the interface. For example, in case the NotificationService interface has numerous usages, and in case we wish to have SMSService as the default implementationat that point we can  code as follows:

@ImplementedBy(SMSService.class)
public interface NotificationService{
    boolean sendNotification(String message, String recipient);
}

Get Java 9 Dependency Injection now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.