无法在apache-camel中创建路由

时间:2017-08-30 13:07:56

标签: java rest spring-boot apache-camel

我正在使用驼峰路线的春季休息应用程序。我需要为每个休息调用创建路由并将数据传输到另一个soap服务器。这是我的代码片段。

休息控制器

public class CreateEmployeeController{
@Autowired
ProducerTemplate producerTemplate;

@RequestMapping (value = "/api/createEmployee",method = RequestMethod.POST)
public void createEmployee(@RequestBody Object employee) {
    producerTemplate.sendBody("direct:createEmployee",employee);
}

骆驼配置

@Configuration
@ComponentScan ("com.employee.restService")
public class RouteConfig extends CamelConfiguration {

}

骆驼路线

@Configuration
@Component
public class CreateEmployeeRouter extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        from("direct:createEmployee")
                .to("spring-ws:CreateEmployeeEndpointService");
    }
}

扶养

<dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <version>2.19.2</version>
        </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.camel/camel-cxf -->
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-cxf</artifactId>
        <version>2.19.2</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.camel/camel-spring-javaconfig -->
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring-javaconfig</artifactId>
        <version>2.19.2</version>
    </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.camel/camel-spring-ws -->
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-spring-ws</artifactId>
    <version>2.19.2</version>
</dependency>

<dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring-boot</artifactId>
        <version>2.19.2</version>
    </dependency>

StackTrace

    org.apache.camel.spring.boot.CamelSpringBootInitializationException: 
org.apache.camel.FailedToCreateRouteException: Failed to create route 
route1 at: >>> To[spring-ws:CreateEmployeeEndpointService] <<< in route: 
Route(route1)[[From[direct:createEmployee]] -> [To[spring-ws... because of Failed to resolve endpoint: spring-ws://CreateEmployeeEndpointService due to: No component found with scheme: spring-ws
        at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:225) ~[camel-spring-boot-2.19.2.jar:2.19.2]

如果我错了,请帮助我。 提前谢谢。

1 个答案:

答案 0 :(得分:0)

将您的驼峰依赖项切换为2.20.0,它对我有用