GirişSpring ile kullanmak için şu satırı dahil
ederiz<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
Spring + JSON kullanmak için Jackson kütüphanesini dahil etmek gerekir. Şöyle
yaparız<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-jackson-starter</artifactId>
<version>3.8.0</version>
</dependency>
Test
application.properties
Tüm alanlar camel.springboot.XXX şeklinde başlar
main-run-controller Alanı
Örnek
camel.springboot.main-run-controller=true
Açıklaması
şöyle
To ensure the Spring Boot application keeps running until being stopped or the JVM terminated, typically only need when running Spring Boot standalone, i.e. not with spring-boot-starter-web when the web container keeps the JVM running, set the camel.springboot.main-run-controller=true property in your configuration.
RouteBuilderRouteBuilder yazısına bakabilirsiniz. RouterBuilder sınıfı bir Spring component'i dir.
Örnek
import org.apache.camel.builder.RouteBuilder;
@SpringBootApplication
public class SpringBootWithCamelApplication extends RouteBuilder {
public static void main(String[] args) {
SpringApplication.run(SpringBootWithCamelApplication.class);
}
@Override
public void configure() throws Exception {
from("file:C:/test1/test.txt").
to("file:C/test2/test.txt")
}
}