Привет, я использую Springboot с Camel, мои маршруты начинаются правильно, но я не могу вызвать остальные apis, так как я не могу их найти.
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.camel</groupId>
<artifactId>spring-camel</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>spring-camel</name>
<description>Demo project for Spring Boot</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<camel.version>2.21.0</camel.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-restlet</artifactId>
<version>${camel.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
application.properties
camel.springboot.xmlRoutes = true
camel.springboot.xmlRoutes = classpath:xml-route/*.xml
camel.springboot.main-run-controller=true
camel.springboot.xmlRests = true
camel.springboot.xmlRests = classpath:xml-rest/*.xml
server.port = 8084
spring.application.name = spring-camel
Springboot Основной класс:
@SpringBootApplication
@EnableAutoConfiguration
public class SpringCamelApplication {
public static void main(String[] args) {
SpringApplication.run(SpringCamelApplication.class, args);
}
}
Маршрут отдыха:
<rests xmlns="http://camel.apache.org/schema/spring">
<rest id="rest-route">
<get uri="/test">
<to uri="direct:test"/>
</get>
</rest>
</rests>
ЖУРНАЛ после запуска приложения:
2018-05-28 12:34:46.178 INFO 4852 --- [ main] o.a.camel.spring.SpringCamelContext : StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
2018-05-28 12:34:46.211 INFO 4852 --- [ main] o.a.camel.component.file.FileEndpoint : Endpoint is configured with noop=true so forcing endpoint to be idempotent as well
2018-05-28 12:34:46.211 INFO 4852 --- [ main] o.a.camel.component.file.FileEndpoint : Using default memory based idempotent repository with cache max size: 1000
2018-05-28 12:34:46.357 INFO 4852 --- [ main] o.a.camel.spring.boot.RoutesCollector : Starting CamelMainRunController to ensure the main thread keeps running
2018-05-28 12:34:46.361 INFO 4852 --- [ main] o.a.camel.spring.SpringCamelContext : Route: first-route started and consuming from: direct://test
2018-05-28 12:34:46.374 INFO 4852 --- [ main] o.a.camel.spring.SpringCamelContext : Route: second-route started and consuming from: file://E://inputFolder?noop=true
2018-05-28 12:34:46.384 INFO 4852 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route1 started and consuming from: restlet:///test?restletMethods=GET
2018-05-28 12:34:46.385 INFO 4852 --- [ main] o.a.camel.spring.SpringCamelContext : Total 3 routes, of which 3 are started
2018-05-28 12:34:46.388 INFO 4852 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.21.0 (CamelContext: camel-1) started in 0.471 seconds
2018-05-28 12:34:46.395 INFO 4852 --- [ main] c.c.springcamel.SpringCamelApplication : Started SpringCamelApplication in 3.543 seconds (JVM running for 3.878)
Так ясно, что 'route1 запущен и потребляет из: restlet: /// test? restletMethods = GET ', но когда я звоню http://localhost:8084/test, он говорит, что недоступен.
Очень нужна помощь, заранее спасибо.