java - Perf4j does not profile annotated Interface method -
i have next interface , class
public interface servicea { @profiled string getstring(); } public class serviceaimpl implements servicea{ string getstring(){ system.out.println("getstring"); } } <beans ....> <aop:aspectj-autoproxy /> <bean id="timingaspect" class="org.perf4j.log4j.aop.timingaspect"/>" <bean id="servicea" class="com.naresh.profiler.service.serviceaimpl" /> </beans>
when servicea.getstring()
phone call not intercepted timingaspect. intercepted if move annotation interface implementation class. reason see method level annotations not inherited. how solve this? writing custombeanannotationprocessor
?
even if @profiled
used @inherit
wouldn't work because inherited annotations ever passed on sub classed , not implementations of interfaces.
@inherited annotations not inherited when used annotate other type. type implements 1 or more interfaces never inherits annotations interfaces implements.
source: http://www.eclipse.org/aspectj/doc/released/adk15notebook/annotations.html#annotation-inheritance
more details: http://www.jroller.com/melix/entry/the_truth_about_annotations_inheritance
what custom processor do, query service's interface @profiled
? suggest manually annotate service implementations because in experience @profiled
helpful if utilize tag
, message
attributes (which differ in each implementing class suppose).
http://perf4j.codehaus.org/devguide.html#adding_the_profiled_annotation_to_method_declarations -> "@profiled(tag = "dynamictag_{$0}")"
java spring annotations perf4j
No comments:
Post a Comment