262.9. Spring XML에서 구성

Spring XML은 두 가지 변형을 제공합니다. Spring 빈을 Java DSL에서 수행되는 방식과 유사한 PropertiesComponent 로 정의할 수 있습니다. 또는 < propertyPlaceholder> 태그를 사용할 수 있습니다.

<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
    <property name="location" value="classpath:com/mycompany/myprop.properties"/>
</bean>

< propertyPlaceholder > 태그를 사용하면 다음과 같이 구성이 약간 더 새로 생성됩니다.

<camelContext ...>
   <propertyPlaceholder id="properties" location="com/mycompany/myprop.properties"/>
</camelContext>

위치 태그를 통해 속성 위치를 설정하면 잘 작동하지만, Camel 2.19.0 에서 시작하고 전용 propertiesLocation으로 속성 위치를 설정할 수 있는 많은 리소스가 있습니다.

<camelContext ...>
  <propertyPlaceholder id="myPropertyPlaceholder">
    <propertiesLocation
      resolver = "classpath"
      path     = "com/my/company/something/my-properties-1.properties"
      optional = "false"/>
    <propertiesLocation
      resolver = "classpath"
      path     = "com/my/company/something/my-properties-2.properties"
      optional = "false"/>
    <propertiesLocation
      resolver = "file"
      path     = "${karaf.home}/etc/my-override.properties"
      optional = "true"/>
   </propertyPlaceholder>
</camelContext>
작은 정보

XML
Camel 2.10 이후 내에서 cache 옵션
을 지정하면 Spring XML뿐만 아니라 Spring XML 내에서 캐시 옵션의 값을 지정할 수 있습니다.