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 ANTLR 4 Listener class methods don't get called
Single Responsibility Principle Implementation on a specific code
Wallet Transfer Method in Java
Java Array help Exception in thread “main” [duplicate]
Dynamically create Java Swing submenus
How to create an object of one class with arguments of another? Java
How to get total row number excel in java include row null?
How to only display variables in thymeleaf which ain't null
Why final key word can guarantee safe publication if constructor is not synchronized?
Unable to display object array using get(index)
CDI Weld omit #Inject
SQL error with mysql variables in hibernate
Unable to access TransactionManager or UserTransaction after updating to Hibernate 5
Unable to reverse engineer to generate pojo using hibernate in eclipse
Selenium webdriver gecodriver error for MAC OS
JAXB umarshall exception

Categories

HOME
arduino-uno
pdf
variables
mediawiki
deezer
elm
infragistics
youtube-api-v3
baqend
ebean
swagger-ui
slick-slider
dax
moonmail
ibm-odm
evopdf
oxyplot
textfield
paging
clickonce
wijmo
microsoft-sync-framework
qhull
publish
nouislider
preg-match-all
twilio-api
pdb
framemaker
y86
fusionpbx
stacked
hue
awt
sas-visual-analytics
gzipstream
elmah
android-mediaprojection
keydown
angular-resource
flickr-api
logparser
clean-architecture
return-value
veracode
mplayer
feeds
boost-preprocessor
sqldf
background-service
eventkit
topbeat
pycaffe
cubes
word-vba-mac
medium.com
spring-android
bonobo
merge-conflict-resolution
player
nsviewcontroller
fadeout
ios4
two-factor-authentication
natvis
maven-tomcat-plugin
jms2
t4mvc
cannon.js
atk4
sankey-diagram
proj4js
dereference
inmobi
device-orientation
website-monitoring
tween
mdt
zend-route
typeof
contenttype
dealloc
resty-gwt
concurrent-collections
html4
sublist
jquery-ui-layout
spring-portlet-mvc
whoosh
fireworks
javax.script
servicehost
digest-authentication
suppress
gin
bespin
brewmp
ti-dsp

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile