Camel Rest DSL: свойство заполнителя больше не работает - PullRequest
0 голосов
/ 08 апреля 2019

В настоящее время я переносю свои приложения из Spring Boot 1.5.19..RELEASE и Camel 2.18.3 в Spring Boot 2.1.4.RELEASE и Camel 2.23.1

Для REST DSL заполнитель свойства Camel отсутствуеткажется, что работает дольше, и я вынужден вернуться к заполнителям Spring.

Я хотел бы отметить, поскольку, возможно, неясно, что код работает в третьем случае

    // SB. 1.5.19, camel 2.18.3 --> WORKS
    private void configureRestServices() {

        rest("{{rest.path.human-resources-codes}}")
            .consumes(APPLICATION_JSON)
            ... 
            .to("{{uri.human-resources-codes.put}}");

    // SB. 2.1.4, camel 2.23.1 --> DOESN'T WORK
    private void configureRestServices() {

        rest("{{rest.path.human-resources-codes}}")
            .consumes(APPLICATION_JSON)
            ... 
            .to("{{uri.human-resources-codes.put}}");

    // SB. 2.1.4, camel 2.23.1 --> WORKS
    @Value(value = "${rest.path.human-resources-codes}")
    private String REST_ENDPOINT_HUMAN_RESOURCES_CODES;

    private void configureRestServices() {

        rest(REST_ENDPOINT_HUMAN_RESOURCES_CODES)
            .consumes(APPLICATION_JSON)
            ... 
            .to("{{uri.human-resources-codes.put}}"); // this one still works.

РЕДАКТИРОВАТЬ

Positive matches:
-----------------

   ConfigServiceBootstrapConfiguration#configServicePropertySource matched:
      - @ConditionalOnProperty (spring.cloud.config.enabled) matched (OnPropertyCondition)
      - @ConditionalOnMissingBean (types: org.springframework.cloud.config.client.ConfigServicePropertySourceLocator; SearchStrategy: all) did not find any beans (OnBeanCondition)

   ConfigurationPropertiesRebinderAutoConfiguration matched:
      - @ConditionalOnBean (types: org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor; SearchStrategy: all) found bean 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' (OnBeanCondition)

   ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesBeans matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesBeans; SearchStrategy: current) did not find any beans (OnBeanCondition)

   ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesRebinder matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder; SearchStrategy: current) did not find any beans (OnBeanCondition)

   EncryptionBootstrapConfiguration matched:
      - @ConditionalOnClass found required class 'org.springframework.security.crypto.encrypt.TextEncryptor' (OnClassCondition)

   PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer matched:
      - @ConditionalOnMissingBean (types: org.springframework.context.support.PropertySourcesPlaceholderConfigurer; SearchStrategy: current) did not find any beans (OnBeanCondition)

РЕДАКТИРОВАТЬ (2)

Caused by: java.lang.IllegalArgumentException: PropertiesComponent with name properties must be defined in CamelContext to support property placeholders. 
Property with key [rest.path.human-resources-codes] not found in properties from text: {{{rest.path.human-resources-codes}}}
    at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.getPropertyValue(DefaultPropertiesParser.java:271) ~[camel-core-2.23.1.jar:2.23.1]
    at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.readProperty(DefaultPropertiesParser.java:157) ~[camel-core-2.23.1.jar:2.23.1]
    at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.doParse(DefaultPropertiesParser.java:116) ~[camel-core-2.23.1.jar:2.23.1]
    at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.parse(DefaultPropertiesParser.java:100) ~[camel-core-2.23.1.jar:2.23.1]
    at org.apache.camel.component.properties.DefaultPropertiesParser.parseUri(DefaultPropertiesParser.java:63) ~[camel-core-2.23.1.jar:2.23.1]
    at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:235) ~[camel-core-2.23.1.jar:2.23.1]
    at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:178) ~[camel-core-2.23.1.jar:2.23.1]
    at org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:2547) ~[camel-core-2.23.1.jar:2.23.1]
    at org.apache.camel.model.rest.RestDefinition.addRouteDefinition(RestDefinition.java:959) ~[camel-core-2.23.1.jar:2.23.1]
...