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

Math formula for populating a grid with boxes
Calling and Testing java method
GreenDao - Saving an Entity and related - “Entity is detached from DAO context”
JBOSS 7.1.1 ear with multiple war CDI scanning all module
Java - Pass double as arguments without giving actual value
HttpURLConnection timeouts in built jar file
Wrong value for hour, minutes and mills when parsing date string to “yyyy-MM-dd'T'HH:mm:ss'-'hh:mm”
How to disable reflections for a single JVM instance
How to translate city names in different languages
jquery dialog with jcrop size issue
Where do I set TransactionOptions with JPA / Google App Engine? [duplicate]
How to access SQL database with Web App and Android App
spring, Jackson, Fasterxml Annotations not work
How to Read/Write data to an external file (.txt) in Java?
Spring 4 Error 415 Unsupported Media Type Error
Listening for data, is while(true) the correct solution? Java

Categories

HOME
ms-access
java
jdo
google-play
hashmap
bookshelf.js
getelementsbytagname
yarn
rascal
mapserver
google-apps-marketplace
alignment
commonmark
iron-router
netflix
serverless-framework
lombok
progressive-web-apps
solaris-10
connection-string
crystal-reports-2008
selectedindexchanged
msys2
jspm
large-file-upload
socialengine
directx-10
bosh
data-manipulation
gtrendsr
http-get
fog
perlin-noise
protovis
repo
accelerate-framework
android-nestedscrollview
stacked
mixture-model
objectlistview
ssjs
awt
broadcastreceiver
hp-ux
total-commander
qcombobox
appcompat
komodoedit
rails-routing
worksheet
python-webbrowser
gabor-filter
lowpass-filter
linode
imanage
webdriverjs
sonarlint-vs
background-service
color-picker
google-feed-api
moveit
goose
itextpdf
associative-array
unity-networking
spidermonkey
muse
php-ci
composite
sonarqube5.1.2
clipperlib
bridge.net
javax.mail
rdtsc
html-helper
gnu-smalltalk
floating-point-precision
ccss
sitemesh
buster.js
plasma
browser-detection
bubble-chart
asyncfileupload
code-cleanup
pydot
yui-datatable
mysql-error-1005
datareader
lang
lpeg
subviews
asp.net-mvc-areas
zend-translate
sortable-tables
filtered-index
exchange-server-2003
premature-optimization
port-number
post-build
multiple-languages
windows-live-messenger
rtml
ntvdm.exe

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile