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

Spring Boot not loading application.properties
Connection reset with FTP/S java
Spring boot CommandLineRunner invokes all classes with run method
mosquitto cloudmqtt bridging
Question mark in Java generics
java threading lock variable propperly
Observer doesn't call update method
Trouble flipping images in Java
Why does SCREEN_ON and SCREEN_OFF have to be registered in Java code?
HSSFWorkbook, maximum textlength of cell, cropped after 700 words
Options to disable cascade without removing annotation
Edit class of java jdk (FormatData_fr.class)
Queries regarding the implementation details of java.util.Hashtable
Returning LinkedList of uppercase Characters when given a LinkedList
dynamically construct SQL by user defined results and conditions within a database which contains multi related or non-related tables
Printing out body parts for hangman game to console

Categories

HOME
testing
arduino-uno
keycloak
push-notification
vmware
windows-server
mvvmcross
onelogin
azure-media-services
in-app-purchase
constraint-programming
modelica
circular-dependency
serilog
normalizr
cx-freeze
intentfilter
cultureinfo
qhull
dynamic-featured-image
atlassian-crucible
webkitspeechrecognition
bcd
exuberant-ctags
siesta-swift
environment-modules
host
appfabric
dartium
qwerty
neuroscience
c11
ansible-playbook
ncalc
core-plot
total-commander
import-from-excel
acoustics
cubic-spline
outlook-2013
hibernate-tools
pubmed
prolog-setof
boost-multi-index
dotnetzip
tizen-native-app
jxcore
android-cursor
np-complete
zendesk-app
webdriverjs
smart-table
parallel-data-warehouse
passport-google-oauth
mathematica-frontend
actionbardrawertoggle
sdf
reactive-banana
execute
intel-fortran
endeca-workbench
varargs
jsapi
system.reflection
block-device
gwidgets
picturefill
transcoding
typo3-neos
dotnetnuke-5
easy-install
eclipse-memory-analyzer
rabl
comaddin
trusted
rdoc
dsn
semantic-diff
hgsubversion
pydot
coredump
xfbml
coda-slider
sproutcore-2
mozilla-prism
firefox4
phonon

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App