繁体   English   中英

Apache CXF和Spring AOP

[英]Apache CXF and Spring AOP

我已经使用Apache Came和Apache CXF以及“代码优先”方法部署了Web服务。 工作正常。

<cxf:cxfEndpoint id="operacionesWSEndpoint" address="/operaciones"
    serviceClass="foo.bar.OperacionesService">
</cxf:cxfEndpoint>

但我想衡量我的服务的性能并进行记录。 为此,我通过以下切入点使用Spring AOP

@Pointcut("execution(* foo.bar.OperacionesService.*(..))")
public void operacionsMethods() {

}

@Around("operacionsMethods()")
public Object logTimeMethod(final ProceedingJoinPoint joinPoint) throws Throwable {

    StopWatch stopWatch =
            new StopWatch(joinPoint.getTarget().getClass().getSimpleName() + "."
                + joinPoint.getSignature().getName());
    stopWatch.start();

    Object retVal = joinPoint.proceed();

    stopWatch.stop();

    log.debug("performance: {}", stopWatch.shortSummary());

    return retVal;
}

好吧,不行。 其他方法和服务正在使用相同的方法(AOP)进行记录,但Camel不会公开Web服务。

我认为我的代码没有任何错误:服务在正常工作,在其他方面也一样。 我觉得我在这里缺少有关Apache Camel的东西-CXF和Spring AOP,但我没有发现类似的问题。

有任何想法吗?

我没有尝试过骆驼和Spring AOP,但是您可以使用骆驼拦截器作为替代。 这并不是您想要的安静。 此外,要进行测量,您可以使用指标库中的“仪表”和Slf4jReporter。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM