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

Java - Connect to a virtual machine instead of Local Host using sockets
Android - populating listView in dynamically created tabs
Html Slurping in Groovy
Error authorization when using the parameters in the request to WooCommerce REST API via Retrofit
How to zoom a PDF in a certain position in Android
Android Studio add tests for newly added methods
Concurrent Queue in Java that only retains the last item of each child thread
Robolectric No shadows modules found containing a org.robolectric.ShadowsAdapter
Getting Started with JAVA and Selenium
Jersey 2 REST Client - Read Multipart Response / OctetStream Response
Insert image into cassandra blob using Java
java generics and program-design, how to properly implement a list which contains subtypes of superclass?
Attempt to store wrong type in array of objects
delegate or proxy or others
Unexpected behaviour test case compare lists of strings
Imageview not displaying captured image

Categories

HOME
compiler-construction
vim
netsuite
reflection
vmware
yahoo-oauth
jxls
alpha
networkx
qore
portia
gitpitch
dax
export-to-csv
jplayer
vb.net-2010
windows-server-2012
quickfix
invantive-sql
crystal-reports-2008
jasonette
mps
crystal-reports-2010
smb
uninstall
typo3-6.2.x
libuv
c++-amp
microsoft-chart-controls
http-get
vsts-build-task
asset-pipeline
form-data
android-kernel
google-api-nodejs-client
mmenu
html5-fullscreen
picasso
theano.scan
particles.js
grid.mvc
reportingservices-2005
http-live-streaming
nand2tetris
eigenvalue
node-sass
sencha-touch-2.3
sas-jmp
google-datalayer
osx-mavericks
zip4j
python-webbrowser
veracode
statsd
boost-preprocessor
pillow
specrun
cubes
angular-strap
abcpdf9
setuptools
wdf
probability-density
mikroc
thrust
google-web-starter-kit
mathematica-frontend
master-slave
packagist
rvest
tcpserver
execute
icu4j
cyclomatic-complexity
python-3.2
arcanist
npapi
geonetwork
fscommand
coldbox
phalanger
qcodo
nsbutton
datagridviewcolumn
concurrent-collections
prettify
quartz-graphics
excel-2003
padarn
interface-orientation
specification-pattern
angularjs-controller
anonymous-methods
gil
funscript
runas
word-processor
tridion-worldserver
assembly-loading
libc++
data-loss
genshi
coercion
createwindow
asp.net-profiles
multi-tier
ajax-forms

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