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 insert a HashMap into a database in java
Cannot use mocked function calls in parameters of verify: too many invocations
JUnit failing from HeadlessException in program using java.awt/javax.swing
How to get name of subclass from an instance of the superclass placed in another class? [duplicate]
getcontentpane method in JFrame class
How testNG report is working internally when we implemented multi thread in class level?
Dynamically reference bundles for integration test with Pax Exam
Resource File Path as String (not streaming)
How to receive a file from a socket and not its content?
How does a developer interact with a 3D designer?
My app crashes when my phone's language is set to Persian or Arabic because of Double.parseDouble
Java 8 lambda adding to a list in a Hashmap, in a Hashmap
Time Service is not working.On Running it shows “Unfortunately Stopped”
JSON array and make it show on Android app
Switch on Enum does not import class
Why is #DiscriminatorColumn ignored when using #JoinTable?

Categories

HOME
xamarin
netbeans
pycharm
mfc
google-api-php-client
iterator
react-router
jgroups
ezpublish
constraint-programming
uber-api
webrequest
facebook-messenger-bot
vault
spring-xd
offline
correlation
spring-tool-suite
visual-studio-cordova
highlight.js
text-rendering
google-cloud-speech
excel-2007
mustache.php
qhull
underflow
status
info.plist
pingfederate
fgetcsv
webkitspeechrecognition
c++-amp
delicious-api
gsoap
junit5
xquery-3.0
uisplitview
siesta-swift
google-qpx-express-api
nssegmentedcontrol
overriding
jmonkeyengine
hilbert-curve
ssjs
sas-visual-analytics
node-sass
sas-jmp
websphere-mq-fte
menuitem
azure-application-gateway
typescript1.8
pebble-watch
setter
pg-dump
np-complete
mako
zendesk-app
imanage
static-ip-address
grails-tomcat-plugin
adxstudio-portals
fody
etsy
fuzzy-search
flash-cs5
superstack
whois
suffix-tree
maven-tomcat-plugin
jms2
lib.web.mvc
ora-00900
eclipse-clp
intellij-14
python-3.2
computer-algebra-systems
android-listview
web-controls
apache-commons-net
id3v2
contenttype
dml
yorick
system.net.webexception
mysql-error-1062
transcoding
blending
soundtouch
dataservice
ril
dataadapter
pygit2
clipper
e4x
pvrtc
hamiltonian-cycle
newtonscript
windows-phone-7.1.1
gwt-ext
mod-auth
coercion
servicehost
imac
blitz++
sortable-tables
dmx512
firefox4
uimenucontroller





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