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

org.apache.commons.fileupload.servlet.ServletFileUpload does not seem to have method setProgressListener
RFIDRW-E-232 can't understand commands from Raspberry Pi
Synchronized objects accessed from unsynchronized methods
Parsing HashMap to Json
How to make a string compare non case sensitive?
.exe file is not working in some systems. created using Launch4J s/w
Enum to String Conversion
issue with spring bean configuration - Error processing XML Spring 4.0.2
In JAVA API why equality check using '==' rather than String.equals() method
Flushing a Hashmap of custom Objects in JSON Format
GCM - How to send notification to multiple device targets with different message contents in java
Using ssl with Apache Mina & android
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException in spring
How to set Label to iText List
Lose JRE 7 Security Alerts and Warnings
Informatica - replace characters in target

Categories

HOME
log4j
wso2-am
debugging
netbeans
isabelle
deezer
pycharm
push-notification
tinymce
angular-material
homebrew
android-4.4-kitkat
infragistics
virtualization
slick-slider
session-variables
offline
google-cloud-spanner
ibm-odm
msp430
lombok
progressive-web-apps
google-static-maps
grails3
opencover
tokenize
sylius
centos6.5
linkerd
typo3-6.2.x
c++-amp
quote
skia
bosh
galsim
preg-match-all
ioio
http-get
framemaker
form-data
mozilla
cloud-code
sequential
nssegmentedcontrol
http-digest
dosbox
android-browser
temporary-files
lumberjack
unoconv
dynamic-reports
reactive-cocoa-5
wptoolkit
dotcover
osx-mavericks
smartcontracts
react-scripts
prolog-setof
domain-model
integrity
composite-key
font-size
np-complete
messenger
xcb
angular-cache
vmware-tools
database-optimization
multi-level
login-control
skobbler-maps
bluemix-app-scan
bluegiga
ptrace
system.management
phpcas
freedesktop.org
jfugue
intel-fortran
sdhc
icu4j
t4mvc
simple-framework
libressl
emailrelay
processmodel
cisco-ios
jsapi
bigbluebutton
geonetwork
dia
preferences
issuu
bitcoinj
elliptic-curve
hyprlinkr
floating-point-precision
c18
runtime.exec
django-nonrel
orchardcms-1.7
flashvars
kyotocabinet
selected
chuck
mt
runas
newtonscript
nsobject
django-tagging
rfc1123
imac
gamequery
forums
ncqrs
compiler-specific
virtual-functions
premature-optimization
project-hosting

Resources

Encrypt Message