Use @Named to differentiate between different objects of the same type bound in the same scope.
@Named("maxWaitTime")
public long maxWaitTimeMs;
@Named("minWaitTime")
public long minWaitTimeMs;
Without the @Named qualifier, the injector would not know which long to bind to which variable.
-
If you want to create annotations that act like
@Named, use the@Qualifierannotation when creating them. -
If you look at
@Named, it is itself annotated with@Qualifier.