Spring Boot에 배포
독립 실행형 모드에서 Spring Boot 애플리케이션 빌드 및 실행
초록
1장. Spring Boot 독립 실행형 시작하기
1.1. Spring Boot 독립 실행형 배포 모드 정보
독립 실행형 배포 모드에서 Spring Boot 애플리케이션은 Jar 파일로 패키지되고 JVM(Java Virtual Machine) 내에서 직접 실행됩니다. 즉, Spring Boot 애플리케이션은 -jar
옵션으로 java
명령을 사용하여 직접 실행할 수 있습니다. 예를 들면 다음과 같습니다.
java -jar SpringBootApplication.jar
여기서 Spring Boot는 실행 가능한 Jar의 기본 클래스를 제공합니다.
애플리케이션 패키징 및 실행에 대한 이러한 접근 방식은 서비스가 최소 요구 사항 세트로 패키지되는 마이크로 서비스 철학과 일치합니다. 컨테이너도 최소화되며 JVM 자체도 마찬가지입니다.
Fuse에서 Spring Boot 독립 실행형 애플리케이션을 빌드하는 데 필요한 요소는 다음과 같습니다.
FuseServiceVersion of materials (BOM) - Red Hat Maven 리포지토리에서 신중하게 분류된 종속 항목을 정의합니다. BOM은 Maven의 종속성 관리 메커니즘을 악용하여 Maven 종속성의 적절한 버전을 정의합니다.
Fuse BOM에 정의된 종속 항목만 Red Hat에서 지원됩니다.
- Spring Boot Maven 플러그인에서 Maven에서 독립 실행형 Spring Boot 애플리케이션에 대한 빌드 프로세스를 구현합니다. 이 플러그인은 Spring Boot 애플리케이션을 실행 가능한 Jar 파일로 패키징합니다.
1.1.1. Spring Boot 2에 배포
Spring Boot 1 외에도 Spring Boot 2에 배포할 수도 있습니다.
OpenShift 배포 모드에 대한 자세한 내용은 OpenShift의 Fuse 가이드를 참조하십시오.
Spring Boot 1과 Spring Boot 2의 모든 차이점에 대한 자세한 내용은 Spring Boot의 마이그레이션 가이드 및 Spring Boot 2 릴리스 노트 를 참조하십시오.
1.1.1.1. Spring Boot 2의 새로운 Camel 구성 요소
Spring Boot 2는 Camel 버전 2.23
을 지원하므로 Spring Boot 1에서 사용할 수 없는 몇 가지 새로운 camel 구성 요소를 지원합니다.
Spring Boot 2의 새로운 Camel 구성 요소
- as2-component
- aws-iam-component
- fhir-component
- google-calendar-stream-component
- google-mail-stream-component
- google-sheets-component
- google-sheets-stream-component
- ipfs-component
- kubernetes-hpa-component
- kubernetes-job-component
- micrometer-component
- mybatis-bean-component
- nsq-component
- rxjava2
- service-component
- spring-cloud-consul
- spring-cloud-zookeeper
- testcontainers-spring
- testcontainers
- web3j-component
2장. Fuse 부스터 사용
Red Hat Fuse는 Fuse 애플리케이션을 시작하고 유용한 구성 요소를 증명할 수 있도록 다음과 같은 부스터를 제공합니다.
- 2.2.1절. “Circuit Breaker booster” - 분산 애플리케이션이 네트워크 연결에 대한 중단 및 백엔드 서비스를 일시적으로 사용할 수 없도록 하는 예는 다음과 같습니다.
- 2.2.2절. “외부화된 구성 부스터” - Apache Camel 경로에 대한 구성을 외부화하는 방법의 예입니다.
- 2.2.3절. “REST API booster” - HTTP 프로토콜을 사용하여 원격(Apache Camel에서 노출) 서비스와 상호 작용하는 메커니즘을 도입하는 예입니다.
2.1. 사전 요구 사항
부스터 데모를 빌드하고 실행하려면 다음 사전 요구 사항을 설치합니다.
2.2. 부스터 프로젝트 생성
개발자가 독립 실행형 애플리케이션을 실행할 수 있도록 Fuse booster 프로젝트가 있습니다. 여기에 제공된 지침은 부스터 프로젝트 인 회로 차단기 부스터 중 하나를 생성하는 방법을 안내합니다. 이 실습에서는 Spring Boot에서 Fuse의 유용한 구성 요소를 보여줍니다.
넷플릭스/Hystrix 회로 차단기를 사용하면 분산 애플리케이션이 네트워크 연결 및 백엔드 서비스의 임시 사용할 수 없는 중단을 처리할 수 있습니다. 회로 차단기 패턴의 기본 개념은 종속 서비스의 손실이 자동으로 감지되고 백엔드 서비스를 일시적으로 사용할 수 없는 경우 대체 동작이 프로그램될 수 있다는 것입니다.
Fuse 회로 차단기 부스터는 두 가지 관련 서비스로 구성됩니다.
-
이름
서비스인 백엔드 서비스는 이름을 Cryostat로 반환합니다. -
인사말
서비스인 frontend 서비스는name
서비스를 호출하여 이름을 가져온 다음 문자열Hello, NAME
을 반환합니다.
이 부스터 데모에서 Hystrix 회로 차단기는 인사말
서비스와 이름
서비스 사이에 삽입됩니다. 백엔드 이름
서비스를 사용할 수 없게 되면 인사말
서비스가 대체 동작으로 대체되고, 이름
서비스가 재시작될 때까지 기다리는 동안 차단되는 대신 즉시 클라이언트에 응답할 수 있습니다.
사전 요구 사항
- Red Hat Developer Platform 에 액세스할 수 있어야 합니다.
- 지원되는 JDK(Java Developer Kit) 버전이 있어야 합니다. 자세한 내용은 지원되는 구성 페이지를 참조하십시오.
- Apache Maven 3.3.x 이상이 있어야 합니다.
절차
- https://developers.redhat.com/launch 로 이동합니다.
START 를 클릭합니다.
시작 관리자 마법사에서 Red Hat 계정에 로그인하라는 메시지가 표시됩니다.
- 로그인 또는 등록 버튼을 클릭한 다음 로그인합니다.
- 시작 관리자 페이지에서 예제 애플리케이션 배포 버튼을 클릭합니다.
- Create Example Application 페이지에서 Create Example Application에 name, fuse-circuit-breaker 를 입력합니다.
- Select an Example 을 클릭합니다.
예제 대화 상자에서 회로 차단기 옵션을 선택합니다. 런타임 선택 드롭다운 메뉴가 표시됩니다.
- Select a Runtime 드롭다운에서 Fuse 를 선택합니다.
-
버전 드롭다운 메뉴에서 7.5(Red Hat Fuse) 를 선택합니다(
2.21.2(Community)
버전을 선택하지 마십시오. - 저장을 클릭합니다.
- 예제 애플리케이션 생성 페이지에서 다운로드를 클릭합니다.
-
애플리케이션 준비 상태 대화 상자가 표시되면
Download.zip
을 클릭합니다. 브라우저에서 생성된 booster 프로젝트를 다운로드합니다( ZIP 파일로 패키징됨). - 아카이브 유틸리티를 사용하여 생성된 프로젝트를 로컬 파일 시스템의 편리한 위치로 추출합니다.
2.2.1. Circuit Breaker booster
넷플릭스/Hystrix 회로 차단기 구성 요소를 사용하면 분산 애플리케이션이 네트워크 연결 중단 및 백엔드 서비스를 일시적으로 사용할 수 없게 되는 문제를 해결할 수 있습니다. 회로 차단기 패턴의 기본 개념은 종속 서비스의 손실이 자동으로 감지되고 백엔드 서비스를 일시적으로 사용할 수 없는 경우 대체 동작이 프로그램될 수 있다는 것입니다.
Fuse 회로 차단기 부스터는 두 가지 관련 서비스로 구성됩니다.
- 이름을 로 반환하는 이름 서비스.
-
name 서비스를 호출하여 이름을 가져온 다음 문자열
Hello, NAME
.
이 데모에서는 인사말 서비스와 이름 서비스 사이에 Hystrix 회로 차단기가 삽입됩니다. 이름 서비스를 사용할 수 없게 되면 인사말 서비스가 다시 시작될 때까지 대기하는 동안 차단하거나 시간 초과하는 대신 대체 동작으로 대체되고 클라이언트에 즉시 응답할 수 있습니다.
2.2.1.1. Circuit Breaker booster를 빌드하고 실행합니다.
회로 차단기 미션에 대한 2.2절. “부스터 프로젝트 생성” 단계를 수행한 후 다음 단계에 따라 회로 차단기 부스터 프로젝트를 빌드하고 실행합니다.
쉘 프롬프트를 열고 Maven을 사용하여 명령줄에서 프로젝트를 빌드합니다.
cd PROJECT_DIR mvn clean package
다음과 같이 새 쉘 프롬프트를 열고 name 서비스를 시작합니다.
cd name-service mvn spring-boot:run -DskipTests -Dserver.port=8081
Spring Boot가 시작되면 다음과 같은 몇 가지 출력이 표시됩니다.
... 2017-12-08 15:44:24.223 INFO 22758 --- [ main] o.a.camel.spring.SpringCamelContext : Total 1 routes, of which 1 are started 2017-12-08 15:44:24.227 INFO 22758 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.20.0 (CamelContext: camel-1) started in 0.776 seconds 2017-12-08 15:44:24.234 INFO 22758 --- [ main] org.jboss.fuse.boosters.cb.Application : Started Application in 4.137 seconds (JVM running for 4.744)
다음과 같이 새 쉘 프롬프트를 열고 인사말 서비스를 시작합니다.
cd greetings-service mvn spring-boot:run -DskipTests
Spring Boot가 시작되면 다음과 같은 몇 가지 출력이 표시됩니다.
... 2017-12-08 15:46:58.521 INFO 22887 --- [ main] o.a.c.c.s.CamelHttpTransportServlet : Initialized CamelHttpTransportServlet[name=CamelServlet, contextPath=] 2017-12-08 15:46:58.524 INFO 22887 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2017-12-08 15:46:58.536 INFO 22887 --- [ main] org.jboss.fuse.boosters.cb.Application : Started Application in 6.263 seconds (JVM running for 6.819)
인사말 서비스는 URL
http://localhost:8080/camel/greetings
에서 REST 끝점을 노출합니다.http://localhost:8080으로 이동합니다.
이 페이지를 열면 서비스를 호출합니다.
이 페이지는 회로 차단기의 상태를 모니터링하는 Hystrix 대시보드에 대한 링크도 제공합니다.
Camel Hystrix에서 제공하는 회로 차단기 기능을 설명하기 위해 이름 서비스가 실행 중인 쉘 프롬프트 창에서 Ctrl+C 를 눌러 백엔드 이름 서비스를 종료합니다.
이제 이름 서비스를 사용할 수 없으므로 회로 차단기가 시작되어 인사말 서비스가 호출될 때 중단되지 않도록 합니다.
Hystrix Monitor 대시보드 및 서비스 출력에서 변경 사항을 확인합니다.
2.2.2. 외부화된 구성 부스터
Externalized Configuration booster는 Apache Camel 경로에 대한 구성을 외부화하는 방법의 예를 제공합니다. Spring Boot 독립 실행형 배포의 경우 구성 데이터는 application.properties
파일에 저장됩니다.
OpenShift 배포에서 Fuse의 경우 구성 데이터는 ConfigMap 오브젝트에 저장됩니다.
2.2.2.1. Externalized Configuration booster 빌드 및 실행
외부 구성 미션에 대한 2.2절. “부스터 프로젝트 생성” 단계를 수행한 후 다음 단계에 따라 로컬 머신의 독립 실행형 프로젝트로 외부 구성 부스터를 빌드하고 실행합니다.
- 프로젝트를 다운로드하고 로컬 파일 시스템에 아카이브를 추출합니다.
프로젝트를 빌드합니다.
cd PROJECT_DIR mvn clean package
서비스를 실행합니다.
mvn spring-boot:run
http://localhost:8080 에 대한 웹 브라우저를 엽니다. 이 페이지에서는 5초마다 서비스를 호출합니다. service는
target/classes/application.properties
파일의booster.nameToGreetvalue
를 사용하여 응답합니다.5초마다 "default"에 대한 인사말을 출력합니다.
booster.nameToGreet
값을 수정합니다.-
편집기에서
target/classes/application.properties
파일을 엽니다. booster.nameToGreetvalue
의 값을 기본값 에서 다른 값으로 변경합니다. 예를 들면 다음과 같습니다.booster.nameToGreetvalue=Thomas
-
편집기에서
- 터미널 창에서 CTRL+C 를 눌러 서비스를 중지합니다.
서비스를 다시 실행합니다.
mvn spring-boot:run
웹 브라우저에서 http://localhost:8080 페이지로 돌아가 서비스 결과 창에서 변경된 값을 확인합니다.
2.2.3. REST API booster
REST API 레벨 0 미션은 REST 프레임워크를 사용하여 비즈니스 작업을 HTTP를 통해 원격 프로시저 호출 끝점에 매핑하는 방법을 보여줍니다. 이 미션은 worldardson Maturity 모델의 레벨 0에 해당합니다.
이 부스트는 HTTP 프로토콜을 사용하여 원격(Apache Camel에서 노출) 서비스와 상호 작용하는 메커니즘을 소개합니다. 이 Fuse booster를 사용하면 신속하게 프로토타입을 생성하고 REST API를 유연하게 설계할 수 있습니다.
이 부스터를 사용하여 다음을 수행합니다.
-
camel/ Cryostatings/{name}
엔드포인트에서 HTTP GET 요청을 실행합니다. 이 요청은Hello, $name!
의 페이로드를 사용하여 JSON 형식으로 응답을 생성합니다. 여기서$name
은 HTTP GET 요청의 URL 매개변수 값으로 교체됩니다. -
URL
{name}
매개변수의 값을 변경하여 응답에 반영된 변경된 값을 확인합니다. - REST API의 Swagger 페이지를 확인합니다.
2.2.3.1. REST API booster 빌드 및 실행
REST API 미션에 대한 2.2절. “부스터 프로젝트 생성” 단계를 수행한 후 다음 단계에 따라 로컬 머신에서 독립 실행형 프로젝트로 REST API booster를 빌드하고 실행합니다.
- 프로젝트를 다운로드하고 로컬 파일 시스템에 아카이브를 추출합니다.
프로젝트를 빌드합니다.
cd PROJECT_DIR mvn clean package
서비스를 실행합니다.
mvn spring-boot:run
- 웹 브라우저를 열고 다음을 수행합니다. http://localhost:8080
예제 HTTP GET 요청을 실행하려면 camel/ingressings/{name} 버튼을 클릭합니다.
localhost:8080/camel/ Cryostatings/Jacopo
URL을 사용하여 새 웹 브라우저 창이 열립니다. URL{name}
매개변수의 기본값은 Jacopo 입니다.JSON 응답은 브라우저 창에 표시됩니다.
{name} 'parameter의 값을 변경하려면 URL을 변경합니다. 예를 들어 이름을 Cryostat로 변경하려면 'localhost:8080/camel/ Cryostatings/ Thomas
를 사용합니다.업데이트된 JSON 응답이 브라우저 창에 표시됩니다.
REST API의 Swagger 페이지를 보려면 API Swagger 페이지 버튼을 클릭합니다.
API swagger 페이지가 브라우저 창에서 열립니다.
3장. Maven으로 빌드
Fuse에서 Spring Boot에 대한 애플리케이션을 개발하는 표준 접근 방식은 Apache Maven 빌드 툴을 사용하고 소스 코드를 Maven 프로젝트로 구성하는 것입니다. Fuse는 Maven 빠른 시작을 통해 빠르게 시작할 수 있으며 많은 Fuse 빌드 툴이 Maven 플러그인으로 제공됩니다. 이러한 이유로 Maven을 Fuse에서 Spring Boot 프로젝트에 대한 빌드 도구로 사용하는 것이 좋습니다.
3.1. Maven 프로젝트 생성
Fuse는 Spring Boot 애플리케이션의 초기 Maven 프로젝트를 생성하는 데 사용할 수 있는 Maven archetypes를 기반으로 다양한 빠른 시작을 제공합니다. 다양한 Maven archetypes의 위치 정보와 버전을 기억할 필요가 없도록 Fuse는 독립 실행형 Spring Boot 프로젝트에 대한 Maven 프로젝트를 생성하는 데 도움이 되는 툴링을 제공합니다.
3.1.1. developers.redhat.com/launch의 프로젝트 생성기
Fuse에서 Spring Boot 독립 실행형을 시작하는 가장 빠른 방법은 developers.redhat.com/launch 로 이동하여 Spring Boot 독립 실행형 런타임 지침을 따라 새 Maven 프로젝트를 생성하는 것입니다. 화면의 지침에 따라 로컬에서 빌드하고 실행할 수 있는 전체 Maven 프로젝트가 포함된 아카이브 파일을 다운로드하라는 메시지가 표시됩니다.
3.1.2. Developer Studio의 Fuse 툴링 마법사
또는 Red Hat JBoss Developer Studio(Fuse Tooling 포함)를 다운로드하여 설치할 수 있습니다. Fuse New Integration Project 마법사를 사용하여 새 Spring Boot 독립 실행형 프로젝트를 생성하고 Eclipse 기반 IDE 내에서 계속 개발할 수 있습니다.
3.2. BOM for Spring Boot에 따라
첫 번째 Spring Boot 프로젝트를 생성하고 빌드한 후 곧 더 많은 구성 요소를 추가하려고 합니다. 그러나 프로젝트에 추가할 Maven 종속 항목의 버전을 어떻게 알 수 있습니까? 가장 간단한(및 권장) 접근 방식은 관련 BOM(Bod of material) 파일을 사용하는 것입니다. 이 파일은 모든 버전 종속 항목을 자동으로 정의하는 것입니다.
3.2.1. BOM 파일 for Spring Boot
BOM(Maven bill of materials) 파일의 목적은 잘 작동하는 Maven 종속성 버전 집합을 제공하여 모든 Maven 아티팩트에 대해 버전을 개별적으로 정의할 필요가 없도록 하는 것입니다.
사용 중인 Spring Boot 버전에 따라 올바른 Fuse BOM을 사용하고 있는지 확인합니다(부팅 1 또는 Spring Boot 2).
Fuse BOM for Spring Boot는 다음과 같은 이점을 제공합니다.
- POM에 종속성을 추가할 때 버전을 지정할 필요가 없도록 Maven 종속 항목에 대한 버전을 정의합니다.
- 특정 버전의 Fuse에서 완전히 테스트 및 지원되는 선별된 종속성 세트를 정의합니다.
- Fuse 업그레이드 간소화.
Fuse BOM에서 정의한 종속성 세트만 Red Hat에서 지원합니다.
3.2.1.1. BOM 파일 통합
BOM 파일을 Maven 프로젝트에 통합하려면 아래 Spring Boot 2 및 Spring Boot 1의 예와 같이 프로젝트의 pom.xml
파일(또는 상위 POM 파일에서)에 dependencyManagement
요소를 지정합니다.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <project ...> ... <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- configure the versions you want to use here --> <fuse.version>7.5.0.fuse-sb2-750029-redhat-00003</fuse.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.redhat-fuse</groupId> <artifactId>fuse-springboot-bom</artifactId> <version>${fuse.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> ... </project>
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <project ...> ... <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- configure the versions you want to use here --> <fuse.version>7.5.0.fuse-750029-redhat-00002</fuse.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.redhat-fuse</groupId> <artifactId>fuse-springboot-bom</artifactId> <version>${fuse.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> ... </project>
종속성 관리 메커니즘을 사용하여 BOM을 지정하면 아티팩트 버전을 지정하지 않고 Maven 종속성을 POM에 추가할 수 있습니다. 예를 들어 camel-hystrix
구성 요소에 대한 종속성을 추가하려면 POM의 종속성
요소에 다음 XML 조각을 추가합니다.
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-hystrix-starter</artifactId> </dependency>
Camel 아티팩트 ID를 -starter
suffix Cryostat- Cryostat로 지정하는 방법에 유의하십시오. 즉 Camel Hystrix 구성 요소를
로 지정합니다. Camel 시작 구성 요소는 Spring Boot 환경에 최적화된 방식으로 패키지됩니다.
camel-hystrix
-starter
3.2.2. Spring Boot Maven 플러그인
Spring Boot Maven 플러그인은 Spring Boot에서 제공하며 Spring Boot 프로젝트를 빌드하고 실행하기 위한 개발자 유틸리티입니다.
-
프로젝트 디렉터리에
mvn 패키지를 입력하여 Spring Boot 애플리케이션에 대한 실행 가능한 Jar 패키지를
빌드 합니다. 빌드 출력은 Maven 프로젝트의target/
하위 디렉터리에 배치됩니다. -
편의를 위해
mvn spring-boot:start
명령을 사용하여 새로 빌드된 애플리케이션을 실행할 수 있습니다.
Spring Boot Maven 플러그인을 프로젝트 POM 파일에 통합하려면 다음 예와 같이 pom.xml
파일의 project/build/plugins
섹션에 플러그인 구성을 추가합니다.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <project ...> ... <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- configure the versions you want to use here --> <fuse.version>7.5.0.fuse-750029-redhat-00002</fuse.version> </properties> ... <build> <plugins> <plugin> <groupId>org.jboss.redhat-fuse</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${fuse.version}</version> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build> ... </project>
4장. Apache Camel in Spring Boot
4.1. Camel Spring Boot 소개
Camel Spring Boot 구성 요소는 Apache Camel에 대한 자동 구성을 제공합니다. Camel 컨텍스트의 자동 구성에서는 Spring 컨텍스트에서 사용할 수 있는 Camel 경로를 자동으로 감지하고 생산자 템플릿, 소비자 템플릿 및 유형 변환기와 같은 주요 Camel 유틸리티를 빈으로 등록합니다.
모든 Camel Spring Boot 애플리케이션은 제품화된 버전으로 dependencyManagement
를 사용해야 합니다. 빠른 시작 시를 참조하십시오. 나중에 태그된 버전은 BOM의 버전을 덮어쓰지 않도록 생략할 수 있습니다.
<dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.redhat-fuse</groupId> <artifactId>fuse-springboot-bom</artifactId> <version>${fuse.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
Camel-spring-boot
param에는 spring.factories
파일이 포함되어 있어 해당 종속성을 클래스 경로에 추가할 수 있으므로 Spring Boot는 자동으로 Camel을 설정합니다.
4.2. Camel Spring Boot Starter 소개
Apache Camel에는 시작자를 사용하여 Spring Boot 애플리케이션을 개발할 수 있는 Spring Boot Starter 모듈이 포함되어 있습니다.
자세한 내용은 link: Apache Camel Spring-Boot 예제 를 참조하십시오.
시작자를 사용하려면 Spring Boot pom.xml
파일에 다음 스니펫을 추가합니다.
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-spring-boot-starter</artifactId> </dependency>
시작자를 사용하면 아래 코드 조각에 표시된 것처럼 Camel 경로가 포함된 클래스를 추가할 수 있습니다. 이러한 경로가 클래스 경로에 추가되면 경로가 자동으로 시작됩니다.
package com.example; import org.apache.camel.builder.RouteBuilder; import org.springframework.stereotype.Component; @Component public class MyRoute extends RouteBuilder { @Override public void configure() throws Exception { from("timer:foo").to("log:bar"); } }
application.properties
또는 application.yml
파일에서 Camel 애플리케이션을 사용자 지정할 수 있습니다.
Camel Spring Boot는 이제 Camel 시작 구성 요소 중 하나를 구성할 때 구성 파일(application.properties 또는 yaml 파일)에서 id 이름으로 8080을 참조할 수 있습니다. src/main/resources/application.properties
(또는 yaml) 파일에서 빈 ID 이름을 참조하여 다른 빈을 참조하는 Camel에서 옵션을 쉽게 구성할 수 있습니다. 예를 들어 xslt 구성 요소는 다음과 같이 8080 ID를 사용하여 사용자 지정 빈을 참조할 수 있습니다.
다음과 같이 ID myExtensionFactory에 의해 사용자 지정 8080을 참조하십시오.
camel.component.xslt.saxon-extension-functions=myExtensionFactory
Spring Boot @Bean 주석을 사용하여 다음과 같이 생성할 수 있는 것은 다음과 같습니다.
@Bean(name = "myExtensionFactory") public ExtensionFunctionDefinition myExtensionFactory() { }
또는 camel-jackson
데이터 형식의 jackson ObjectMapper의 경우:
camel.dataformat.json-jackson.object-mapper=myJacksonMapper
4.3. 자동 구성 Camel 컨텍스트
Camel 자동 구성에서는 CamelContext
인스턴스를 제공하고 SpringCamelContext
를 생성합니다. 또한 해당 컨텍스트의 종료를 초기화하고 수행합니다. 이 Camel 컨텍스트는 camelContext
8080 이름 아래에 Spring 애플리케이션 컨텍스트에 등록되며 다른 Spring 8080과 마찬가지로 액세스할 수 있습니다.
예를 들어 다음과 같이 camelContext
에 액세스할 수 있습니다.
@Configuration public class MyAppConfig { @Autowired CamelContext camelContext; @Bean MyService myService() { return new DefaultMyService(camelContext); } }
4.4. Camel 경로 자동 감지
Camel 자동 구성은 Spring 컨텍스트에서 모든 RouteBuilder
인스턴스를 수집하고 CamelContext
에 자동으로 삽입합니다. Spring Boot 시작기를 사용하여 새 Camel 경로를 생성하는 프로세스를 단순화합니다. 클래스 경로에 @Component
주석이 달린 클래스를 추가하여 경로를 생성할 수 있습니다.
@Component public class MyRouter extends RouteBuilder { @Override public void configure() throws Exception { from("jms:invoices").to("file:/invoices"); } }
@Configuration
클래스에 새 경로 RouteBuilder
8080을 생성하려면 아래를 참조하십시오.
@Configuration public class MyRouterConfiguration { @Bean RoutesBuilder myRouter() { return new RouteBuilder() { @Override public void configure() throws Exception { from("jms:invoices").to("file:/invoices"); } }; } }
4.5. Camel 속성
Spring Boot 자동 구성은 속성 자리 표시자, OS 환경 변수 또는 Camel 속성을 지원하는 시스템 속성과 같은 Spring Boot 외부 구성에 자동으로 연결됩니다.
이러한 속성은 application.properties
파일에 정의되어 있습니다.
route.from = jms:invoices
시스템 속성으로 사용
java -Droute.to=jms:processed.invoices -jar mySpringApp.jar
Camel 경로에서 자리 표시자로 사용합니다.
@Component public class MyRouter extends RouteBuilder { @Override public void configure() throws Exception { from("{{route.from}}").to("{{route.to}}"); } }
4.6. 사용자 정의 Camel 컨텍스트 구성
Camel 자동 구성으로 생성한 CamelContext
8080에서 작업을 수행하려면 다음과 같이 Spring 컨텍스트에서 CamelContextConfiguration
인스턴스를 등록해야 합니다.
@Configuration public class MyAppConfig { ... @Bean CamelContextConfiguration contextConfiguration() { return new CamelContextConfiguration() { @Override void beforeApplicationStart(CamelContext context) { // your custom configuration goes here } }; } }
CamelContextConfiguration
및 beforeApplicationStart(CamelContext)
방법은 Spring 컨텍스트가 시작되기 전에 호출되므로 이 콜백에 전달된 CamelContext
인스턴스는 완전히 자동으로 구성됩니다. CamelContextConfiguration
의 많은 인스턴스를 Spring 컨텍스트에 추가할 수 있으며 모든 인스턴스가 실행됩니다.
4.7. Cryostat 비활성화
auto-configured CamelContext
use camel.springboot.jmxEnabled
속성을 비활성화하려면 기본적으로 활성화되어 있습니다.
예를 들어 application.properties
파일에 다음 속성을 추가할 수 있습니다.
camel.springboot.jmxEnabled = false
4.8. 자동 구성된 소비자 및 생산자 템플릿
Camel 자동 구성은 사전 구성된 ConsumerTemplate
및 ProducerTemplate
인스턴스를 제공합니다. 이를 Spring 관리 빈에 삽입할 수 있습니다.
@Component public class InvoiceProcessor { @Autowired private ProducerTemplate producerTemplate; @Autowired private ConsumerTemplate consumerTemplate; public void processNextInvoice() { Invoice invoice = consumerTemplate.receiveBody("jms:invoices", Invoice.class); ... producerTemplate.sendBody("netty-http:http://invoicing.com/received/" + invoice.id()); } }
기본적으로 소비자 템플릿 및 생산자 템플릿에는 엔드포인트 캐시 크기가 1000으로 설정되어 있습니다. 다음 Spring 속성을 사용하여 해당 값을 변경할 수 있습니다.
camel.springboot.consumerTemplateCacheSize = 100 camel.springboot.producerTemplateCacheSize = 200
4.9. 자동 구성된 TypeConverter
Camel 자동 구성에서는 Spring 컨텍스트에서 typeConverter
라는 TypeConverter
인스턴스를 등록합니다.
@Component public class InvoiceProcessor { @Autowired private TypeConverter typeConverter; public long parseInvoiceValue(Invoice invoice) { String invoiceValue = invoice.grossValue(); return typeConverter.convertTo(Long.class, invoiceValue); } }
4.10. Spring 유형 변환 API 브리지
Spring은 유형 변환 API 로 구성됩니다. Spring API는 Camel 유형 변환기 API 와 유사합니다. 두 API Camel Spring Boot 간의 유사점으로 인해 Spring 변환 API에 위임하는 브리지 변환기(SpringTypeConverter
)가 자동으로 등록됩니다. 즉, 즉시 사용 가능한 Camel은 Camel과 유사한 Spring Cryostat를 처리합니다.
이를 통해 다음과 같이 Camel TypeConverter
API를 사용하여 Camel 및 Spring 컨버터에 모두 액세스할 수 있습니다.
@Component public class InvoiceProcessor { @Autowired private TypeConverter typeConverter; public UUID parseInvoiceId(Invoice invoice) { // Using Spring's StringToUUIDConverter UUID id = invoice.typeConverter.convertTo(UUID.class, invoice.getId()); } }
여기에서 Spring Boot는 애플리케이션 컨텍스트에서 사용할 수 있는 Spring의 ConversionService
인스턴스로 변환을 위임합니다. ConversionService
인스턴스를 사용할 수 없는 경우 Camel Spring Boot 자동 구성으로 ConversionService
인스턴스가 생성됩니다.
4.11. 유형 변환 기능 비활성화
TypeConverter
인스턴스 또는 Spring 브리지와 같은 Camel Spring Boot의 유형 변환 기능을 비활성화하려면 다음과 같이 camel.springboot.typeConversion
속성을 false
로 설정합니다.
camel.springboot.typeConversion = false
4.12. XML 경로 추가
기본적으로 Camel XML 경로를 classpath에 배치하면 camel-spring-boot
가 자동으로 탐지되고 포함됩니다. Camel 버전 2.17 이상에서 다음과 같이 구성 옵션을 사용하여 디렉터리 이름을 구성하거나 이 기능을 비활성화할 수 있습니다.
// turn off camel.springboot.xmlRoutes = false // scan in the com/foo/routes classpath camel.springboot.xmlRoutes = classpath:com/foo/routes/*.xml
XML 파일은 다음과 같이 CamelContext
경로가 아닌 Camel XML 경로여야 합니다.
<routes xmlns="http://camel.apache.org/schema/spring"> <route id="test"> <from uri="timer://trigger"/> <transform> <simple>ref:myBean</simple> </transform> <to uri="log:out"/> </route> </routes>
<camelContext>와 함께 Spring XML 파일을 사용하는 경우 Spring XML 파일 및 application.properties 파일에서 Camel을 구성할 수 있습니다. 예를 들어 Camel에 이름을 설정하고 스트림 캐싱을 켜려면 다음을 추가합니다.
camel.springboot.name = MyCamel camel.springboot.stream-caching-enabled=true
4.13. XML Rest-DSL 추가
기본적으로 Camel Rest-DSL XML 경로를 클래스 경로의 camel-rest
디렉토리에 배치할 수 있으며, camel-spring-boot
는 자동으로 감지되고 포함됩니다. 다음과 같이 구성 옵션을 사용하여 디렉터리 이름을 구성하거나 이 기능을 비활성화할 수 있습니다.
// turn off camel.springboot.xmlRests = false // scan in the com/foo/routes classpath camel.springboot.xmlRests = classpath:com/foo/rests/*.xml
Rest-DSL XML 파일은 Camel XML rests이어야 하며 다음과 같은 CamelContext
가 아니어야 합니다.
<rests xmlns="http://camel.apache.org/schema/spring"> <rest> <post uri="/persons"> <to uri="direct:postPersons"/> </post> <get uri="/persons"> <to uri="direct:getPersons"/> </get> <get uri="/persons/{personId}"> <to uri="direct:getPersionId"/> </get> <put uri="/persons/{personId}"> <to uri="direct:putPersionId"/> </put> <delete uri="/persons/{personId}"> <to uri="direct:deletePersionId"/> </delete> </rest> </rests>
4.14. Camel Spring Boot로 테스트
Spring Boot에서 실행되는 Camel의 경우 Spring Boot는 @Component
로 주석이 추가된 Camel 및 모든 경로를 자동으로 포함합니다. Spring 부팅으로 테스트할 때 @ContextConfiguration
대신 @SpringBootTest
를 사용하여 사용할 구성 클래스를 지정합니다.
다른 RouteBuilder 클래스에 Camel 경로가 여러 개인 경우 Camel Spring Boot에 이러한 경로가 모두 포함됩니다. 따라서 하나의 RouteBuilder 클래스에서만 경로를 테스트하려면 다음 패턴을 사용하여 활성화할 RouteBuilders를 포함하거나 제외할 수 있습니다.
- java-routes-include-pattern: 패턴과 일치하는 RouteBuilder 클래스를 포함하는 데 사용됩니다.
- java-routes-exclude-pattern: 패턴과 일치하는 RouteBuilder 클래스를 제외하는 데 사용됩니다. exclude는 include보다 우선합니다.
다음과 같이 단위 테스트 클래스에서 이러한 패턴을 @SpringBootTest
주석의 속성으로 지정할 수 있습니다.
@RunWith(CamelSpringBootRunner.class) @SpringBootTest(classes = {MyApplication.class); properties = {"camel.springboot.java-routes-include-pattern=**/Foo*"}) public class FooTest {
FooTest
클래스에서 포함 패턴은 **/Foo*
이며, 이는 Cryostat 스타일 패턴을 나타냅니다. 여기에서 패턴은 선행 패키지 이름과 일치하는 이중 별표로 시작됩니다. /foo*
는 클래스 이름이 FooRoute로 시작해야 함을 의미합니다. 다음 maven 명령을 사용하여 테스트를 실행할 수 있습니다.
mvn test -Dtest=FooTest
4.15. 예를 들면 다음과 같습니다.
4.16. Spring Boot, Apache Camel 및 외부 메시징 브로커 사용
4.16.1. 외부 메시징 브로커 사용.
Fuse는 외부 메시징 브로커를 사용합니다. 지원되는 브로커, 클라이언트 및 Camel 구성 요소 조합에 대한 자세한 내용은 지원되는 구성을 참조하십시오.
Camel 구성 요소는 JMS connection-factory에 연결되어 있어야 합니다. 아래 예제에서는 camel-amqp
구성 요소를 JMS 연결 요소에 연결하는 방법을 보여줍니다.
import org.apache.activemq.jms.pool.PooledConnectionFactory; import org.apache.camel.component.amqp.AMQPComponent; import org.apache.qpid.jms.JmsConnectionFactory; ... AMQPComponent amqpComponent(AMQPConfiguration config) { JmsConnectionFactory qpid = new JmsConnectionFactory(config.getUsername(), config.getPassword(), "amqp://"+ config.getHost() + ":" + config.getPort()); qpid.setTopicPrefix("topic://"); PooledConnectionFactory factory = new PooledConnectionFactory(); factory.setConnectionFactory(qpid); AMQPComponent amqpcomp = new AMQPComponent(factory);
부록 A. Maven 사용 준비
A.1. 개요
이 섹션에서는 Red Hat Fuse 프로젝트 빌드를 위한 Maven을 준비하는 방법을 간략하게 설명하고 Maven 아티팩트를 찾는 데 사용되는 Maven 좌표 개념을 소개합니다.
A.2. 사전 요구 사항
Maven을 사용하여 프로젝트를 빌드하려면 다음과 같은 사전 요구 사항이 있어야 합니다.
- Maven 설치 Cryostat- CryostatMaven는 Apache의 오픈 소스 빌드 툴입니다. Maven 다운로드 페이지에서 최신 버전을 다운로드할 수 있습니다.
네트워크 연결 Cryostat- Cryostatwhilst 빌드를 수행, Maven은 동적으로 외부 리포지토리를 검색하고 필요한 아티팩트를 즉시 다운로드합니다. 기본적으로 Maven은 인터넷을 통해 액세스하는 리포지토리를 찾습니다. Maven이 로컬 네트워크에 있는 리포지토리를 검색하도록 이 동작을 변경할 수 있습니다.
참고Maven은 오프라인 모드에서 실행할 수 있습니다. 오프라인 모드에서 Maven은 로컬 리포지토리에서만 아티팩트를 찾습니다.
A.3. Red Hat Maven 리포지토리 추가
Red Hat Maven 리포지토리에서 아티팩트에 액세스하려면 Maven의 settings.xml
파일에 추가해야 합니다. Maven은 사용자의 홈 디렉터리의 .m2
디렉터리에서 settings.xml
파일을 찾습니다. 사용자가 settings.xml
파일이 지정되지 않은 경우 Maven은 M2_HOME/conf/
에서 시스템 수준 settings.xml 파일을 사용합니다.
settings.xml
Red Hat 리포지토리를 Maven의 리포지토리 목록에 추가하려면 새 .m2/settings.xml
파일을 생성하거나 시스템 수준 설정을 수정할 수 있습니다. settings.xml
파일에서 Maven에 Red Hat Fuse 리포지토리 추가 와 같이 Red Hat 리포지토리의 리포지토리 요소를 추가합니다.
Maven에 Red Hat Fuse 리포지토리 추가
<?xml version="1.0"?> <settings> <profiles> <profile> <id>extra-repos</id> <activation> <activeByDefault>true</activeByDefault> </activation> <repositories> <repository> <id>redhat-ga-repository</id> <url>https://maven.repository.redhat.com/ga</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>redhat-ea-repository</id> <url>https://maven.repository.redhat.com/earlyaccess/all</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>jboss-public</id> <name>JBoss Public Repository Group</name> <url>https://repository.jboss.org/nexus/content/groups/public/</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>redhat-ga-repository</id> <url>https://maven.repository.redhat.com/ga</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> <pluginRepository> <id>redhat-ea-repository</id> <url>https://maven.repository.redhat.com/earlyaccess/all</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> <pluginRepository> <id>jboss-public</id> <name>JBoss Public Repository Group</name> <url>https://repository.jboss.org/nexus/content/groups/public</url> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>extra-repos</activeProfile> </activeProfiles> </settings>
A.4. 아티팩트
Maven 빌드 시스템의 기본 빌딩 블록은 아티팩트 입니다. Maven 빌드를 수행한 후 아티팩트의 출력은 일반적으로 JAR 또는 WAR와 같은 아카이브입니다.
A.5. Maven 좌표
Maven 기능의 핵심 측면은 아티팩트를 찾고 이들 간의 종속성을 관리하는 기능입니다. Maven은 특정 아티팩트의 위치를 고유하게 정의하는 Maven 좌표 시스템을 사용하여 아티팩트의 위치를 정의합니다. 기본 좌표 튜플의 형식은 {groupId,artifactId,version}
입니다. 경우에 따라 Maven은 추가 좌표, 패키징 및 분류기 를 사용하여 좌표의 기본 세트를 보강하는 경우가 있습니다. 튜플은 기본 좌표 또는 추가 패키징 좌표를 사용하거나 패키징 및 분류자 좌표를 모두 추가하여 다음과 같이 작성할 수 있습니다.A tuple can be written with the basic coordinates, or with the additional packaging coordinate, or with the addition of both the packaging and classifier coordinates, as follows:
groupdId:artifactId:version groupdId:artifactId:packaging:version groupdId:artifactId:packaging:classifier:version
각 좌표는 다음과 같이 설명될 수 있습니다:
- groupdId
-
아티팩트 이름의 범위를 정의합니다. 일반적으로
org.fusesource.example
.NET Framework와 같이 패키지 이름의 전체 또는 일부를 그룹 ID 부여로 사용합니다. - artifactId
- 아티팩트 이름(그룹 ID에 따라)을 정의합니다.
- 버전
-
아티팩트의 버전을 지정합니다. 버전 번호는 최대 4개의 부분을 가질 수 있습니다.
n.n.n.n
은 버전 번호의 마지막 부분에 숫자가 아닌 문자를 포함할 수 있습니다(예:1.0-SNAPSHOT
의 마지막 부분은 영숫자 하위 문자열0-SNAPSHOT
). - 패키지
-
프로젝트를 빌드할 때 생성되는 패키지 엔터티를 정의합니다. OSGi 프로젝트의 경우 패키지는
번들
입니다. 기본값은 Cryostat입니다
. - 분류자
- 동일한 POM에서 빌드되었지만 콘텐츠가 다른 아티팩트를 구분할 수 있습니다.
그룹 ID, 아티팩트 ID, 패키징 및 버전은 아티팩트의 POM 파일에서 해당 요소에 의해 정의됩니다. 예를 들면 다음과 같습니다.
<project ... > ... <groupId>org.fusesource.example</groupId> <artifactId>bundle-demo</artifactId> <packaging>bundle</packaging> <version>1.0-SNAPSHOT</version> ... </project>
예를 들어 이전 아티팩트에 대한 종속성을 정의하려면 POM에 다음 종속성
요소를 추가할 수 있습니다.
<project ... > ... <dependencies> <dependency> <groupId>org.fusesource.example</groupId> <artifactId>bundle-demo</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> ... </project>
번
들은 특정 종류의 JAR 파일일 뿐이고, Cryostat는 기본 Maven 패키지 유형이므로 이전 종속성에서 번들 패키지 유형을 지정할 필요가 없습니다. 종속성에서 명시적으로 패키징 유형을 지정해야 하는 경우
type
요소를 사용할 수 있습니다.
부록 B. Spring Boot Maven 플러그인
B.1. Spring Boot Maven 플러그인 개요
이 부록은 Spring Boot Maven 플러그인을 설명합니다. Maven에서 Spring Boot 지원을 제공하며 실행 가능한 root 또는 war 아카이브를 패키징하고 애플리케이션을 인플레이스( in-place
) 실행할 수 있습니다.
B.2. 목표
Spring Boot 플러그인의 목표는 다음과 같습니다.
-
Spring-boot:run
은 Spring Boot 애플리케이션을 실행합니다. -
spring-boot:repackage
는.jar
및.war
파일을 실행할 수 있도록 다시 패키징합니다. -
spring-boot:start
및spring-boot:stop
둘 다 Spring Boot 애플리케이션의 라이프사이클을 관리하는 데 사용됩니다. -
spring-boot:build-info
는 액추에이터가 사용할 수 있는 빌드 정보를 생성합니다.
B.3. 사용법
Spring Boot 플러그인을 사용하는 방법에 대한 일반적인 지침은 https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#using 에서 확인할 수 있습니다. 다음 예제에서는 Spring Boot에 spring-boot-maven-plugin
을 사용하는 방법을 보여줍니다.
Spring Boot Maven 플러그인에 대한 자세한 내용은 https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/ 을 참조하십시오.
B.3.1. Spring Boot 2용 Spring Boot Maven 플러그인
<project> <modelVersion>4.0.0</modelVersion> <groupId>com.redhat.fuse</groupId> <artifactId>spring-boot-camel</artifactId> <version>1.0-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <!-- configure the Fuse version you want to use here --> <fuse.bom.version>7.5.0.fuse-sb2-750029-redhat-00003</fuse.bom.version> <!-- maven plugin versions --> <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version> <maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version> </properties> <build> <defaultGoal>spring-boot:run</defaultGoal> <plugins> <plugin> <groupId>org.jboss.redhat-fuse</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${fuse.bom.version}</version> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <repositories> <repository> <id>redhat-ga-repository</id> <url>https://maven.repository.redhat.com/ga</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>redhat-ea-repository</id> <url>https://maven.repository.redhat.com/earlyaccess/all</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>redhat-ga-repository</id> <url>https://maven.repository.redhat.com/ga</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> <pluginRepository> <id>redhat-ea-repository</id> <url>https://maven.repository.redhat.com/earlyaccess/all</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </project>
B.3.2. Spring Boot 1용 Spring Boot Maven 플러그인
<project> <modelVersion>4.0.0</modelVersion> <groupId>com.redhat.fuse</groupId> <artifactId>spring-boot-camel</artifactId> <version>1.0-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <!-- configure the Fuse version you want to use here --> <fuse.bom.version>7.5.0.fuse-750029-redhat-00002</fuse.bom.version> <!-- maven plugin versions --> <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version> <maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version> </properties> <build> <defaultGoal>spring-boot:run</defaultGoal> <plugins> <plugin> <groupId>org.jboss.redhat-fuse</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${fuse.bom.version}</version> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <repositories> <repository> <id>redhat-ga-repository</id> <url>https://maven.repository.redhat.com/ga</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>redhat-ea-repository</id> <url>https://maven.repository.redhat.com/earlyaccess/all</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>redhat-ga-repository</id> <url>https://maven.repository.redhat.com/ga</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> <pluginRepository> <id>redhat-ea-repository</id> <url>https://maven.repository.redhat.com/earlyaccess/all</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </project>