Announcement Announcement Module
No announcement yet.
Aspect not recognized Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Aspect not recognized

    I read a couple of parent/child application context related posts but didnt really understand the solution.

    Secondly I do not have a Spring MVC project, rather I am exposing the service methods as Web Services using Java EE @Webservice annotations.

    I have a simple Logging Aspect Class to log all public methods as follows:

    public class RvlxLoggingAspect
    	private static final Logger LOG = Logger.getLogger(RvlxLoggingAspect.class);
    	@Pointcut("execution(public * *(..))")
    	private void loggingOperation() {}
    	public void logJoinPoint(JoinPoint joinPoint) {
    		System.out.println("Aspect: Before calling " + joinPoint.getSignature().getName());
    Also I have 2 context files - applicationContext.xml and applicationContextDao.xml files that are loaded in web.xml as follows:


    I read in a previous post that the proxies generated do not carry the target annotations (which means @WebService would have been dropped in proxy classes). But what about logging the DAO classes?

    I am currently UNIT-Testing this app using AbstractDependencyInjectionSpringContextTests, so is there any alternative way of testing AOP?

  • #2
    I missed explaining the issue above:

    For the above example, the Logging aspect is not being recognized, hence loaded/weaved and applied to the regular execution of the application.
    Let me know what's missing?


    • #3
      It is assumed that your aspect is loaded into the context and processed because it is marked by @Component, right? Did you define corresponding <context:component-scan base-package="xxx"/> element at the XML configuration?


      • #4
        Yes I do have all the necessities in the applicationContext.xml file

        <context:annotation-config />
        <context:component-scan base-package="" />
        <aop:aspectj-autoproxy />


        • #5
          Post complete small example that illustrates your problem here.