Annotation Interface Typed
Explicitly specifies the types that should be used for dependency injection.
This annotation allows you to limit which types of a bean should be available for injection. It can be used to prevent unintended automatic binding of implemented interfaces or extended classes.
Example usage:
@Typed(ServiceImpl.class) public class ServiceImpl implements Service { // Implementation }
- Since:
- 4.0.0
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
Class<?>[] valueSpecifies the types that should be considered for dependency injection.When specified, only the listed types will be available for injection, even if the class implements or extends other types. If empty, the default behavior is to make all supertypes available for injection.
Example:
@Typed({Service.class, Monitored.class}) public class ServiceImpl implements Service, Monitored, Logging { // Only Service and Monitored will be available for injection, // Logging interface will be ignored }
- Returns:
- an array of classes that should be considered for injection
- Default:
{}
-