CDI programmatic 모델은 애플리케이션 초기화 시 발생하는 typesafe resolution 메커니즘을 선호하지만 나중에 프로그래밍 방식 조회 메커니즘을 사용하여 애플리케이션 실행 중에 동적 / 지연 삽입을 수행할 수 있습니다.
Camel CDI는 Camel 프리미티브의 표준 주입에 사용할 수 있는 CDI 한정자에 해당하는 주석 리터럴을 편의를 제공합니다. 이러한 주석 리터럴은 지연 주입 / 프로그램 조회를 수행하는 CDI 진입점인 javax.enterprise.inject.Instance 인터페이스와 함께 사용할 수 있습니다.
예를 들어 @Uri 한정자에 대해 제공된 주석 리터럴을 사용하여 Camel 기본에 대해 지체적으로 조회할 수 있습니다(예: ProducerTemplate 빈의 경우).
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Camel 컨텍스트 유형을 기반으로 선택 사항을 구체화할 수도 있습니다. 예를 들면 다음과 같습니다.
@Any
@Inject
Instance<CamelContext> contexts;
// Refine the selection by type
Instance<DefaultCamelContext> context = contexts.select(DefaultCamelContext.class);
// Check if such a bean exists then retrieve a reference
if (!context.isUnsatisfied())
context.get();
@Any
@Inject
Instance<CamelContext> contexts;
// Refine the selection by type
Instance<DefaultCamelContext> context = contexts.select(DefaultCamelContext.class);
// Check if such a bean exists then retrieve a reference
if (!context.isUnsatisfied())
context.get();
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Camel 컨텍스트를 선택하는 단계를 반복할 수도 있습니다. 예를 들면 다음과 같습니다.
@Any
@Inject
Instance<CamelContext> contexts;
for (CamelContext context : contexts)
context.setUseBreadcrumb(true);
@Any
@Inject
Instance<CamelContext> contexts;
for (CamelContext context : contexts)
context.setUseBreadcrumb(true);
Copy to ClipboardCopied!Toggle word wrapToggle overflow