java
Custom Annotation processor not being invoked by tomcat
Custom Annotation processor is not being invoked by tomcat. Following is the Annotation processor code that I am using : #SuppressWarnings("restriction") #SupportedAnnotationTypes("io.strati.rs.cxf2.bindings.MyAnnotation") #SupportedSourceVersion( SourceVersion.RELEASE_8 ) public class SimpleAnnotationProcessor extends AbstractProcessor { public static List<String> str = new ArrayList<>(); #Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { System.out.println("Into annotation processor ... 2"); for ( Element element : roundEnv.getElementsAnnotatedWith(MyAnnotation.class)) { System.out.println("Method name is:"+element.getSimpleName()); str.add(element.getSimpleName().toString()); } return false; } } This stores the method name of all the methods that have the custom annotation. This is what the annotation class looks like : #Target({ ElementType.TYPE, ElementType.METHOD }) #Retention(value = RetentionPolicy.RUNTIME) public #interface MyAnnotation { } I am trying to access the list in a tomcat application as follows : #GET #Path("/dummy") #MyAnnotation #Produces({APPLICATION_JSON, APPLICATION_XML, TEXT_XML}) public void print(){ System.out.println("List is:"+SimpleAnnotationProcessor.str); } The list is getting printed as empty even though the method has the annotation.I have specified the annotation in the maven compiler plugin as well as specified it in META-INF/services/javax.annotation.processing.Processor. Can someone tell me what are the possible reasons due to which the annotation processor is not getting invoked ?
Related Links
Java ANTLR 4 Listener class methods don't get called
Single Responsibility Principle Implementation on a specific code
Wallet Transfer Method in Java
Java Array help Exception in thread “main” [duplicate]
Dynamically create Java Swing submenus
How to create an object of one class with arguments of another? Java
How to get total row number excel in java include row null?
How to only display variables in thymeleaf which ain't null
Why final key word can guarantee safe publication if constructor is not synchronized?
Unable to display object array using get(index)
CDI Weld omit #Inject
SQL error with mysql variables in hibernate
Unable to access TransactionManager or UserTransaction after updating to Hibernate 5
Unable to reverse engineer to generate pojo using hibernate in eclipse
Selenium webdriver gecodriver error for MAC OS
JAXB umarshall exception