Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 399 Bytes

File metadata and controls

22 lines (16 loc) · 399 Bytes

java-custom-annotation-injection

There is an example of Custom Injection in your class.

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface MyCustomInject {
    Class whichClass();
}

Usage

@MyCustomInject(whichClass = Dog.class)
public static Animal animal;

@MyCustomInject(whichClass = Horse.class)
public static Animal anotherAnimal;