【发布时间】:2019-05-02 12:39:08
【问题描述】:
我有一个 spring soap web 服务,我想使用自定义日志记录方面来衡量它的性能。该方面对于普通的 spring bean 工作正常,但没有被 Endpoint-invokeInternal 方法调用。对于类似受保护的方法,春天是否有任何限制......?感谢任何帮助以使其正常工作?
代码示例:
@Component
@Aspect
public class AspectLogging {
@Around(value = "execution(* *(..)) && @annotation(logTime)", argNames = "logTime")
public Object logAround(ProceedingJoinPoint joinPoint, LogTime logTime) throws Throwable {
// Time logging goes here...
}
}
弹簧上下文:
<aop:aspectj-autoproxy proxy-target-class="true"/>
<!-- Aspect -->
<bean id="aspectLog" class="com.x.y.AspectLogging" />
Spring WS 端点:
public class MyEndPoint extends AbstractJDomPayloadEndpoint {
@LogTime
protected Element invokeInternal(Element request) throws Exception {
// Service call goes here...
}
}
更新: 将访问修饰符更改为 public 后它起作用了,这是否意味着 Spring 允许 AOP 仅适用于 public 方法?
【问题讨论】:
标签: spring-aop spring-ws