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 configure OneToOne releationship between the primarykey and foreignkey?
Performance efficient way to check a string in a Set
Java: What is the difference between block increment and unit increment and what are these values used for?
Error checking in Eclipse for a single file
Best mechanism to close java sockets?
YouTube API does not play videos as expected
jqGrid not load using #Transactional
How to trigger an event using Parse for Android via push notification?
Retrieve data using Gson
String array : Adding elements in Loop
Android ArrayIndexOutOfBoundsException..?
How to trigger servlet execution on application start?
DES Decryption: Given final block not properly padded
Jar file created by Maven does not have project code
Java's toString Method Not Being Overridden
How do I timeout a blocking call inside an EJB?

Categories

HOME
google-chrome-extension
pdf
openstack
reflection
minimum-spanning-tree
stock
office365api
rsyslog
jira
jpeg
fingerprint
multiple-records
quickbooks
orchardcms
netflix
iolanguage
uitypeeditor
reactcsstransitiongroup
pythonanywhere
flux
text-rendering
conemu
css-animations
core-text
mmap
firebase-crash-reporting
opennlp
underflow
facet
assistant
preg-match
google-qpx-express-api
copying
usbserial
bitbucket-pipelines
xcode-extension
web-mining
twitch
theano.scan
avro4s
sencha-touch-2.3
long-polling
user-accounts
mako
vtigercrm
objective-c-swift-bridge
wdf
ado.net-entity-data-model
sts-springsourcetoolsuite
mikroc
ctest
mongocsharpdriver
blackberry-10
suffix-tree
design-by-contract
associative-array
ford-fulkerson
natvis
maven-tomcat-plugin
endeca-workbench
retina
responsive-images
php-ci
dundas
proj4js
geonetwork
fscommand
modalpopup
tween
dd
camanjs
cdt
android-nested-fragment
jubula
xceed-datagrid
ftps
bulkloader
eventlistener
flashvars
wsdl-2.0
clipper
factory-method
free-variable
referrer
anonymous-methods
sublist
quickdialog
datawindow
twrequest
hgsubversion
boost-filesystem
datareader
site.master
ext3
project-hosting

Resources

Encrypt Message