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

Printing a random string from my ArrayList to the console
R-java RPM for RHEL 5
Issue running Web app in eclipse with tomcat 8 on mac
Declaring an array 100x100 or 99x99
How to give user choose folder option while downloading file in javaFX
Can't center nodes within a border pane
How will the condition work in JOptionPane?
Android-Apllication Class act as singleton?
download a file from Spring boot rest service
How to solve Vertx blocking DNS issue
How to use getter in string in Java
Lost updates in Cassandra
Java Logger logs everything
upgrading form hibernate3 to hibernate 4.2
Clear browser Cookies with Selenium WebDriver
returning value from arrays

Categories

HOME
twitter
cloud
omnet++
reserved
angular-material
office365api
fme
getelementsbytagname
graphql
jpeg
opengl-es-2.0
bs4
basic
python-unittest
google-translate
kibana-4
metatrader4
nano-server
postgres-xl
alignment
text-rendering
alpine
dcevm
chromium-embedded
claims-based-identity
dxf
filezilla
dbclient
fabric8
socialengine
directx-10
gtrendsr
http-get
xmlreader
accelerate-framework
dartium
web-mining
neuroscience
code-search-engine
unobtrusive-validation
android-tabhost
eclipse-scout
mime
angular2-meteor
angular-resource
user-accounts
flickr-api
jlink
hls.js
worker-thread
snmptrapd
typed-lambda-calculus
boost-preprocessor
dynamics-sl
synchronous
setuptools
instant
phishing
asp.net-4.5
packagist
ios4
prerequisites
google-places
t4mvc
android-listview
notify
java.util.concurrent
asp.net-web-api-odata
rdl
rtmfp
algebraic-data-types
pyhdf
floating-point-precision
bulkloader
random-seed
nsnetservice
propertyeditor
javaspaces
nsmanagedobject
gnu-prolog
gcj
nintendo-ds
uimenucontroller
simpletest
3gp

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile