12.6. Fabric8 Karaf 청사진 지원 추가
fabric8-karaf-blueprint 는 Aries PropertyEvaluator 및 속성 자리 표시자를 fabric8-karaf-core 에서 사용하여 청사진 XML 파일의 자리 표시자를 해결합니다.
절차
사용자 지정 Karaf 배포판에 청사진 지원 기능을 포함하려면
pom.xml의startupFundueures 섹션에fabric8-karaf-blueprint를 추가합니다.<startupFeatures> ... <feature>fabric8-karaf-blueprint</feature> ... </startupFeatures>
예제
fabric8 evaluator는 ${env+service:MY_ENV_VAR} 와 같은 체인된 평가자를 지원합니다. MY_ENV_VAR 변수를 환경 변수에 대해 확인해야 합니다. 그러면 서비스 기능을 사용하여 결과가 해결됩니다. 예를 들면 다음과 같습니다.
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.3.0
http://aries.apache.org/schemas/blueprint-ext/blueprint-ext-1.3.xsd">
<ext:property-placeholder evaluator="fabric8" placeholder-prefix="$[" placeholder-suffix="]"/>
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="userName" value="$[k8s:secret:$[env:ACTIVEMQ_SERVICE_NAME]/username]"/>
<property name="password" value="$[k8s:secret:$[env:ACTIVEMQ_SERVICE_NAME]/password]"/>
<property name="brokerURL" value="tcp://$[env+service:ACTIVEMQ_SERVICE_NAME]"/>
</bean>
</blueprint>
중요
중첩된 속성 자리 표시자 대체에는 Aries Blueprint Core 1.7.0 이상이 필요합니다.