Camel CxfEndpoint 设置地址在第一次调用后不起作用

Camel CxfEndpoint set address doesnt work after first call

我想在每次到达端点 bean 时设置地址。当我第一次调用 setAddress 时,地址和端点 url 发生变化,但 ws 调用转到了第一个地址。这是我的代码

@Bean
public CxfEndpoint xWSwithoutAddress() {
    final CxfEndpoint endpoint = new CxfEndpoint();
    endpoint.setServiceClass(IntegrationSoap.class);
    return endpoint;
}

@Bean
@Scope(value="prototype",proxyMode = ScopedProxyMode.TARGET_CLASS)
public CxfEndpoint xWS() {
    XSettings settings = configFileManager.readSettings(XSettings.class);
    final CxfEndpoint endpoint = xWSwithoutAddress();
    endpoint.setAddress(settings.getWsdlAddress());
    return endpoint;
}

和路线

from("direct:getEbysServices")
        .to("cxf:bean:xWS?wrapped=true&loggingFeatureEnabled=true");

停止和启动路线解决了我的问题。

我给路由一个id

from("direct:getEbysServices")
        .routeId("ebysRoute")
        .to("cxf:bean:xWS?wrapped=true&loggingFeatureEnabled=true");

当地址改变时,我停止并开始路线。

camelContext.stopRoute("ebysRoute");
camelContext.startRoute("ebysRoute");