Announcement Announcement Module
Collapse
No announcement yet.
why this simple point-cut newver called? its a Basic sample of point cut Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • why this simple point-cut newver called? its a Basic sample of point cut

    my making a sample aop for my understand. it is for log.
    i did following. below is my aspectj class

    HTML Code:
    package com.myorg.springaop.examples;
    
    import org.aspectj.lang.ProceedingJoinPoint;
    
    public class MyLoggingAspect
    {
        public Object log(ProceedingJoinPoint call) throws Throwable
        {
            System.out.println("entering method " );
    
            Object point =  call.proceed();
    
            System.out.println("exiting method ");        
    
            return point;
        }
    
    }
    ---------------
    above class mapped in applicationContext in following manner

    HTML Code:
    <bean id="LoggingAspect"  class = "com.myorg.springaop.examples.MyLoggingAspect"/>
    <aop:config>
          <aop:aspect ref="LoggingAspect">
             <aop:pointcut id="myCutLogging"
                        expression="execution(*  com.myorg.springaop.examples..*.*(..))"/>
             <aop:around pointcut-ref="myCutLogging" method="log"/>
          </aop:aspect>
    </aop:config>
    ---
    i'm using spring 2.5.6
    my header of appContext is following
    HTML Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

    still no output is display (of log() in MyLoggingAspect)
    where i'm wrong in above case?

  • #2
    How are you loading the application context and also be aware that it only works on beans defined in the application context. It doesn't work for beans/objects constructed with new...

    Comment

    Working...
    X