Кодировка properties в Apache Camel
Есть необходимость использовать русские символы в .properties. Согласно документации Camel считывает атрибуты в формате ISO-8859-1. Есть ли способ изменить эту кодировку на UTF-8?
Я использую Camel в связке с Blueprint контейнером:
<?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 http://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-cm/v1.2.0 ">
<ext:property-placeholder id="limit-processor">
<ext:default-properties>
<ext:property name="encoding" value="UTF-8"/>
</ext:default-properties>
<ext:location>file:etc/ActiveMQConnection.properties</ext:location>
<ext:location>file:etc/automation/somth.properties</ext:location>
</ext:property-placeholder>
Вышеописанный способ не работает
Ответы (1 шт):
Автор решения: dmitry
→ Ссылка
Получилось найти решение. В ext:property-placeholder нет атрибута encoding, поэтому он по умолчанию всегда считывает в ISO-8859-1. Нужно было убрать из него файлы properties, в которых есть кириллица, и перенести в Camel'овский propertyPlaceholder:
<ext:property-placeholder id="limit-processor">
<ext:location>file:etc/ActiveMQConnection.properties</ext:location>
</ext:property-placeholder>
---------------------------------
<camelContext id="proc_tvh_limit" xmlns="http://camel.apache.org/schema/blueprint" messageHistory="true">
<propertyPlaceholder id="properties" location="file:etc/automation/somth.properties" encoding="UTF-8"/>
<!-- route -->
<routeBuilder ref="Router"/>
</camelContext>