@Target specifies where an annotation can be applied; @Retention determines its lifespan.
The @Target annotation restricts where your custom annotation can be used, such as methods, fields, or classes. The @Retention annotation specifies whether the annotation is available at runtime, compile time, or not at all. For example, @Retention(RetentionPolicy.RUNTIME) makes the annotation available for reflection at runtime.
Additional Notes
How do @Target and @Retention influence custom annotations?