I'm trying to advise (for logging purposes) methods that uses @RequestMappging annotations in a Spring Web App with an Aspect. Here is my aspect class:
@Aspect
public class InboundSpringPerfLoggerAspect extends AbstractInboundPerfLoggerAspect {
@Around(value = "execution(* *(..)) && @annotation(requestMapping)" , argNames = "pjp, requestMapping")
public Object doPerfLoggingForOperation(final ProceedingJoinPoint pjp, final RequestMapping requestMapping) throws Throwable {
return doPerfLogging(pjp, LOGGER_NAME);
}
My XML servlet configuration (MVC context) file is this:
<aop:aspectj-autoproxy/>
<!-- Logging aspect for inbound rest calls -->
<bean id="inboundServicePerfLoggerAspect" class="common.logging.aspect.InboundSpringPerfLoggerAspect"/>
<context:annotation-config />
<context:component-scan base-package="web.configuration" />
<context:component-scan base-package="web.controller" />
<context:component-scan base-package="web..service" />
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<bean name="xmlViewResolver" class="org.springframework.web.servlet.view.XmlViewResolver">
<property name="order" value="1" />
</bean>
</beans>
However at start up in DEBUG mode logs from Spring shows same message:
DEBUG [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping] Rejected bean name 'inboundServicePerfLoggerAspect': no URL paths identified
And of course controllers classes are not properly advised. They worked fine but no Spring proxy AOP takes place.
Where is the problem?
Thanks