简体   繁体   中英

System property used in camel for velocity template uses default value, not environment-level setting

I'm using Spring and Camel for a small service. Both are drawing on several locations for properties files, including environment-specific settings file specified on the server launch config.

Spring:

<context:property-placeholder
        location="classpath*:config/*.properties,classpath:config/*.properties, file:${application.properties.file}"/>

Camel context:

<propertyPlaceholder id="properties" location="classpath:config/camel-constant.properties,
            config/application.properties, file:${application.properties.file}"/>

this seems to be fine for eg endpoint configuration:

<endpoint id="supplierEmail" uri="smtp:${mailsender.host}?contentType=text/html"/>

But I want to access a property in my velocity template. If I try eg

<setHeader headerName="environment_id">
    <simple>${properties:environment.id}</simple>
</setHeader>

$headers.environment_id in velocity template picks up a value, but it's the default value, not the value from the environment-level properties file.

What have I missed?

Sorry, ignore. Config was pointing at the wrong flipping file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM