English 中文(简体)
java.lang.Illegal ArgumentException:差错0
原标题:java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut

Thinker.java

package springdemo2;

public interface Thinker {
    void thinkOfSomething(String thoughts); 
}

Volunteer.java

package springdemo2;

public class Volunteer implements Thinker{
    private String thoughts;

    @Override
    public void thinkOfSomething(String thoughts) {
        this.thoughts=thoughts;
    }

    public String getThoughts(){
        return thoughts;
    }
}

MindReader.java

package springdemo2;

public interface MindReader {
    void interceptThoughts(String thoughts);

    String getThoughts();
}

Magician.java

package springdemo2;

import org.aspectj.lang.annotation.Aspect; 
import org.aspectj.lang.annotation.Before; 
import org.aspectj.lang.annotation.Pointcut;

@Aspect 
public class Magician implements MindReader {

    private String thoughts;

    @Pointcut("execution(* springdemo2."
            + "Thinker.thinkOfSomething(String)) and args(thoughts)")
    public void thinking(String thoughts){
    }

    @Override
    @Before("thinking(thoughts)")
    public void interceptThoughts(String thoughts) {
        this.thoughts=thoughts;
        System.out.println("Advice method intercepted Thoughts..."+thoughts);
    }

    @Override
    public String getThoughts() {
        return thoughts;
    }
}

<>XML(Spring)

我在我的XML档案中列入了<aop:aspectj-autoproxy/>

I goed following Error 信

 java.lang.IllegalArgumentException: error at ::0 formal unbound in
 pointcut
最佳回答
@Pointcut("execution(* springdemo2."
    + "Thinker.thinkOfSomething(String)) and args(thoughts)")

应当

@Pointcut("execution(* springdemo2."
    + "Thinker.thinkOfSomething()) && args(thoughts)")
问题回答
@Before("thinking(thoughts)")

应当

@Before("thinking(String) && args(thoughts)")

承诺使用“和”操作者将设计要素联系起来。 在 Java,你可以使用“&&”经营者。 “和”只在XML中提供。

However, if the parameters of each method are not the same, how to do?

I ll tell you:

Spring use the Annotation annotation using the Joinpoint cross declaration in aopalliance.jar:org.aopalliance.intercept.Joinpoint.

Xml配置使用Joinjoint。 jar Join statement:org.aspectj.lang.JoinPoint.

因此,你应当使用手法中的一些方面。

Caused by: java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut <aop:after-throwing method="except" pointcut-ref="myPointCut" throwing="e"/>





相关问题
array dependency injection in spring?

is there a way to use dependency injection to inject all available implementations of a specific interface in spring? This is kind of the same thing as asked here for .NET. Though my aim is to use @...

Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Grails Packaging and Naming Conventions

Packaging Controllers, Services,etc. i.e. - com.company.controllers - com.company.services Is this a good practice or should be avoided by all means?? Another worth mentioning problem I encountered ...

How can I determine Objects in application context?

I am trying to write a portlet for Liferay (using Tomcat and Spring) and need to use a database via Persistence API/Hibernate. I am using some configuration XMLs (applicationContext.xml, etc.) and ...

How to prevent JPA from rolling back transaction?

Methods invoked: 1. Struts Action 2. Service class method (annotated by @Transactional) 3. Xfire webservice call Everything including struts (DelegatingActionProxy) and transactions is configured ...

热门标签