gpt4 book ai didi

java - 切入点未拦截适当的点

转载 作者:行者123 更新时间:2023-12-01 12:50:09 26 4
gpt4 key购买 nike

EventServiceAspect.java

public EventServiceAspect{
@Pointcut(value="call(* com.xyz.ServiceInput.callSetup(..))")
public void anyCallSetup(){}

@After("anyCallSetup() && @annotation(publishEventToService)")
public void publishEvent(JoinPoint jp, PublishEventToService publishEventToService){
log.warn("batman is here!");
}
}

SampleClass.java

public SampleClass{
@PublishEventToService
public void someFunc(){
serviceInput.callSetup("testing testing")
}
}

callSetup 没有被切入点拦截。知道我的代码有什么问题吗?

这是一个很大的配置文件...相关部分是:

<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"
default-init-method="init">

<aop:aspectj-autoproxy proxy-target-class = "true"/>

最佳答案

关于java - 切入点未拦截适当的点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24286462/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com