59.8. Camel 빈 통합
59.8.1. Camel 주석
Camel 빈 통합의 일부로 Camel에는 Camel CDI에서 원활하게 지원하는 일련의 주석이 제공됩니다. http://camel.apache.org/bean-integration.html#BeanIntegration-Annotations 따라서 CDI 빈에서 이러한 주석을 사용할 수 있습니다. 예를 들면 다음과 같습니다.
| Camel 주석 | CDI와 동일 | |
|---|---|---|
| 구성 속성 |
@PropertyInject("key")
String value;
| DeltaSpike 구성 메커니즘 을 사용하는 경우: @Inject @ConfigProperty(name = "key") String value; 자세한 내용은 구성 속성을 참조하십시오. |
| 생산자 템플릿 삽입(기본 Camel 컨텍스트) |
@Produce(uri = "mock:outbound") ProducerTemplate producer; @Produce(uri = "mock:outbound") FluentProducerTemplate producer; |
@Inject
@Uri("direct:outbound")
ProducerTemplate producer;
@Produce(uri = "direct:outbound")
FluentProducerTemplate producer;
|
| 끝점 삽입(기본 Camel 컨텍스트) |
@EndpointInject(uri = "direct:inbound") Endpoint endpoint; |
@Inject
@Uri("direct:inbound")
Endpoint endpoint;
|
| 끝점 주입 (이름별 컨텍스트) |
@EndpointInject(uri = "direct:inbound",
context = "foo")
Endpoint contextEndpoint;
|
@Inject
@ContextName("foo")
@Uri("direct:inbound")
Endpoint contextEndpoint;
|
| 빈 주입(유형별) |
@BeanInject MyBean bean; |
@Inject MyBean bean; |
| 빈 주입(이름별) |
@BeanInject("foo")
MyBean bean;
|
@Inject
@Named("foo")
MyBean bean;
|
| POJO 사용 |
@Consume(uri = "seda:inbound")
void consume(@Body String body) {
//...
}
|
|