spring - Error when using @Before("args(name)") -
I'm writing a simple aspect application with Spring. My Spring version is 4.1.4. When I run my code, I get this run-time error as below:
My aspect category is as follows: And the main task is: How can I solve this problem?
package org.mehrdad.Apect; Import org.aopalliance.intercept.Joinpoint; Import org.aspectj.lang.JoinPoint; Import org.aspectj.lang.annotation.Apect; Import org.aspectj.lang.annotation.Before; Import org.aspectj.lang.annotation.Pointcut; Import org.mehrdad.model.Circle; @Aspect Public Category LoggingAspect {@Before ("allCircleMethods ()") Public Zero LoggingAdvice (JoinPoint jp) {} @Before ("Arg (name)") Public Zero stringArgumentMethods (string name) {println ("name" + name) ; } @Pointcut ("execution (* get * ())" public public allerground (allgir) () {} @Pointcut ("org.mehrdad.model.Circle") Public Zero allCircleMethods () {}}
package org.mehrdad.AOPSpring; Import org.mehrdad.Service.ShapeService; Import org.springframework.context.ApplicationContext; Import org.springframework.context.support.ClassPathXmlApplicationContext; Public class AopMain {public static void (String [] args) {// TODO auto-created method stub ApplicationContext reference = New ClassPathXmlApplicationContext ("spring.xml"); Size service service size = reference.get ("size service", size service). ShapeService.getCircle () setName ("ahahaha") .; Println (shapeService.getCircle () getName ().); }}
After
no it is:
@Before (argNames = "name ")
Comments
Post a Comment