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

how to exclude or setnull on some parameter if edittext is empty
explain in detail TimeBasedTriggeringPolicy for log4j2 v2.3
Partial mocking on class that do not follow SOLID principles (especially Dependency Injection)
Using Google Api Java class in Unity?
Using Java-8 AES/GCM to authenticate / encrypt parts of a data block
Vaadin - productionMode on Spring Boot customized Servlet
No persistence unit with name 'DefaultPersistenceUnit' found [duplicate]
Read live MIDI data from a piano and output to console?
Periodically update a file in WEB-INF without restarting application - Google App Engine
how to select particular nodes to assert using xml unit
How to write a Repository method for a parent entity that returns child entities?
Error in inserting a string parameter to a cypher query in a java code
Which one is better between static block or Spring autowired?
Java Concurrency in app server
Deserialize JSON object name-value pairs as elements of an array
Repeated entries into the sql table in my java program which is used to enter data from an xml file to an sql table

Categories

HOME
vim
blogger
pypi
oracle11g
image-processing
malloc
installshield
virtualization
elasticsearch-hadoop
nano-server
izpack
quicklook
fortumo
after-effects
highlight.js
text-rendering
mmap
sqlcipher
qhull
su
internet-explorer-9
large-file-upload
tinymce-4
gammu
amazon-kinesis-kpl
environment-modules
revolution-slider
suricata
simplexml
bitbucket-pipelines
nxlog
acoustics
thin
segment
fault
azure-application-gateway
dandelion
jxcore
diagnostics
sybase-asa
memory-alignment
spring-mongodb
sonarlint-vs
blacklist
google-cdn
watchconnectivity
setuptools
paypal-express
fuzzy-search
dataview
php-internals
itextpdf
jfugue
hsv
r-tree
simple-framework
appfabric-cache
sniffer
kineticjs
relocation
qcodo
mesa
valueconverter
marmalade
apc
comaddin
free-variable
browser-detection
path-separator
cisco-jtapi
errai
viewswitcher
bubble-chart
punbb
qt-jambi
servicehost
appendto
dentrix
thunderbird-lightning
database-management
anti-piracy
rtml
lzh

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