CDI compilation failure - annotation type not applicable to this kind of declaration

I have a Weld qualifier annotation declared like this:

@Target({Field, Method, Constructor})
public @interface AccountResponse {

My bean interface is this:

public interface Responder {
    /* Declares stuff */

The qualified implementation is this:

public class AccountResponseResponder implements Responder {
    /* Does stuff */

The Maven compiler says (on

annotation type not applicable to this type of declaration

I'm sure I'm missing something obvious, but what it is escapes me. Any help would be appreciated.

1 answer

  • answered 2017-11-12 19:35 Antoniossss

    @Target({Field, Method, Constructor}) Means you can only apply this annotation to given parts of your code. In order to enable class annotation you would have to add Type to the @Target