我正在

groovy.lang.MissingMethodException: No signature of method: org.apache.camel.builder.AdviceWithBuilder.replaceFromWith() is applicable for argument types: (org.apache.camel.component.direct.DirectEndpoint) values: [direct://start]


方法的签名是AdviceWithBuilder.replaceFromWith(Endpoint ep)
我传入了实现端点的DirectEndpoint
我试图强迫它到端点

@Test
void testSubmitDocument() {
    final Endpoint endpoint = context.getEndpoint("direct:start",Endpoint.class)
    camelContext.getRouteDefinitions().get(0).adviceWith(camelContext,
         new AdviceWithRouteBuilder (){
             void configure(){
                 weaveById("bar").replaceFromWith(endpoint)
             }
        }

    )
    }

最佳答案

因为AdviceWithRouteBuilder.weaveById(String pattern)返回AdviceWithBuilder并且没有replaceFromWith方法。

10-06 02:36