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

Proguard Obfuscation Error
List all commits of a branch since it was created from master with JGit
How can I integrate Woocommerce into an Android Application?
Java Futures: Could someone explain me the program flow
Intellij duplicate class found in the file
Jdk update 121 URLClassloader change
Connection to db isn't closed after query ends
How can I display multiple JPanel's from different classes onto my JFrame?
Memory consumption from drawString method out of control. Memory leak? (Graphics)
get Data from DB using Spring MVC to show in dropdown list like Country, state, city
Best way to verify text in a table is between 2 specified items - Selenium - Java
Is it standard practice create an instance of a class within that class?
zk framework: message 'unknown message code:<code>' instead of standart labels
RESTClient cannot connect to Oauth 2.0 server
Spontaneous up spring boot context in test
Not able to access Second Database using Spring batch

Categories

HOME
java
netbeans
openstack
activiti
fluentd
tinymce
appx
youtube-dl
setup-deployment
enterprise-library-5
opengl-es-2.0
bs4
pheatmap
facebook-php-sdk
adobe-analytics
spring-xd
correlation
flask-wtforms
quickfix
netflix
libtiff
pythonanywhere
jtextfield
zapier
cloudhub
ehcache
excel-2007
claims-based-identity
autosys
opennlp
bootstrap-duallistbox
social-media
fluentvalidation
xacml
assistant
nat
winrt-xaml-toolkit
webtest
protovis
phpfreechat
cloud-code
lto
lumberjack
android-tabhost
elmah
http-live-streaming
isbn
http-redirect
wptoolkit
logfiles
angular-resource
outlook-2013
errordocument
theming
domain-model
aurelia-validation
magma
capacity
cudafy.net
hittest
objective-c-swift-bridge
log4c
mikroc
etsy
maven-tomcat-plugin
metaclass
dukescript
tableau-online
web-controls
block-device
phalanger
castle
project-planning
mesa
starcluster
uitouch
picturefill
ember-charts
flashvars
google-email-migration
dice
onsubmit
wse3.0
buildr
eclipse-templates
whoosh
gwt-ext
f#-powerpack
pyinotify
h.323
dmx512
gin
mirah
database-management
libs
spec#
multiple-languages
rtml
uiq3

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