6.3. Camel Spring Boot 애플리케이션 구조

Camel Spring Boot 애플리케이션의 디렉터리 구조는 다음과 같습니다.

  ├── LICENSE.md
  ├── pom.xml
  ├── README.md
  ├── configuration
  │   └── settings.xml
  └── src
      ├── main
      │   ├── fabric8
      │   │   └── deployment.yml
      │   ├── java
      │   │   └── org
      │   │       └── example
      │   │           └── fis
      │   │               ├── Application.java
      │   │               └── MyTransformer.java
      │   └── resources
      │       ├── application.properties
      │       ├── logback.xml
      │       └── spring
      │           └── camel-context.xml
      └── test
          └── java
              └── org
                  └── example
                      └── fis

다음 파일이 애플리케이션을 개발하는 데 중요한 위치:

pom.xml
추가 종속 항목을 포함합니다. Spring Boot와 호환되는 Camel 구성 요소는 시작 버전(예: camel-jdbc-starter 또는 camel-infinispan-starter )에서 사용할 수 있습니다. 시작자가 pom.xml 에 포함되면 부팅 시 Camel 컨텐츠에 자동으로 구성 및 등록됩니다. 사용자는 application.properties 파일을 사용하여 구성 요소의 속성을 구성할 수 있습니다.
application.properties

구성을 외부화하고 다른 환경에서 동일한 애플리케이션 코드로 작업할 수 있습니다. 자세한 내용은 Externalized Configuration을 참조하십시오.

예를 들어 이 Camel 애플리케이션에서는 애플리케이션 이름 또는 IP 주소와 같은 특정 속성을 구성할 수 있습니다.

application.properties

#spring.main.sources=org.example.fos

logging.config=classpath:logback.xml

# the options from org.apache.camel.spring.boot.CamelConfigurationProperties can be configured here
camel.springboot.name=MyCamel

# lets listen on all ports to ensure we can be invoked from the pod IP
server.address=0.0.0.0
management.address=0.0.0.0

# lets use a different management port in case you need to listen to HTTP requests on 8080
management.port=8081

# disable all management endpoints except health
endpoints.enabled = false
endpoints.health.enabled = true

Application.java

애플리케이션을 실행하는 데 중요한 파일입니다. 사용자는 여기에서 Spring DSL을 사용하여 경로를 구성하기 위해 camel-context.xml 파일을 가져옵니다.

Application.java 파일은 @Configuration,@EnableAutoConfiguration@ComponentScan 과 동일한 @SpringBootApplication 주석을 지정합니다.

Application.java

@SpringBootApplication
// load regular Blueprint file from the classpath that contains the Camel XML DSL
@ImportResource({"classpath:blueprint/camel-context.xml"})

Spring Boot 애플리케이션을 실행하는 기본 방법이 있어야 합니다.

Application.java

public class Application {
    /**
     * A main method to start this application.
     */
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

camel-context.xml

src/main/resources/spring/camel-context.xml 은 Camel 경로가 포함되어 있으므로 애플리케이션을 개발하는 데 중요한 파일입니다.

참고

Spring-Boot 애플리케이션 개발에 대한 자세한 내용은 첫 번째 Spring Boot Application 개발에서확인할 수 있습니다.

src/main/fabric8/deployment.yml

fabric8-maven-plugin에서 생성된 기본 OpenShift 구성 파일과 병합되는 추가 구성을 제공합니다.

참고

이 파일은 Spring Boot 애플리케이션의 일부를 사용하지 않지만 CPU 및 메모리 사용과 같은 리소스를 제한하는 데 모든 빠른 시작에서 사용됩니다.