Spring Integration
  1. Spring Integration
  2. INT-359

Using PropertyPlaceholderConfigurer for integer values

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0 M6
    • Fix Version/s: 1.0 Final
    • Component/s: Adapters
    • Labels:
      None

      Description

      Properties defined as integer/long in the xml schema cannot be externalized using PropertyPlaceholderConfigurer. Attributes like the "max-messages-per-poll" and "perid" of the <poller> element come to mind.

      http://forum.springframework.org/showthread.php?t=57349

        Issue Links

          Activity

          Hide
          Jerry Gaines added a comment -

          Isn't this a duplicate of INT-302 ?

          Show
          Jerry Gaines added a comment - Isn't this a duplicate of INT-302 ?
          Hide
          Mark Fisher added a comment -

          Yes, I've marked it as a duplicate issue.

          Show
          Mark Fisher added a comment - Yes, I've marked it as a duplicate issue.
          Hide
          Martti von Hertzen added a comment -

          Is this fixed? I get the following exception with RC2. It seems that it tries to format the property placeholder instead of its value:

          Caused by: java.lang.NumberFormatException: For input string: "$

          {adaptation.hwimport.pdf.pollPeriod}"
          at java.lang.NumberFormatException.forInputString(Unknown Source)
          at java.lang.Long.parseLong(Unknown Source)
          at java.lang.Long.valueOf(Unknown Source)
          at org.springframework.integration.config.xml.IntegrationNamespaceUtils.createIntervalTrigger(IntegrationNamespaceUtils.java:164)
          at org.springframework.integration.config.xml.IntegrationNamespaceUtils.configureTrigger(IntegrationNamespaceUtils.java:149)
          at org.springframework.integration.config.xml.AbstractPollingInboundChannelAdapterParser.doParse(AbstractPollingInboundChannelAdapterParser.java:45)
          at org.springframework.integration.config.xml.AbstractChannelAdapterParser.parseInternal(AbstractChannelAdapterParser.java:58)
          at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:56)
          at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
          at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297)
          at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
          at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
          at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)

          The config file looks like this (the directory placeholder resolves just fine):

          <file:inbound-channel-adapter directory="file:${adaptation.hwimport.pdf.directory}"
          filter="adaptation.hwimport.pdf.compositeFilter"
          channel="adaptation.hwimport.pdf.filesInChannel" >
          <si:poller max-messages-per-poll="100">
          <si:interval-trigger interval="${adaptation.hwimport.pdf.pollPeriod}

          "/>
          </si:poller>
          </file:inbound-channel-adapter>

          Show
          Martti von Hertzen added a comment - Is this fixed? I get the following exception with RC2. It seems that it tries to format the property placeholder instead of its value: Caused by: java.lang.NumberFormatException: For input string: "$ {adaptation.hwimport.pdf.pollPeriod}" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Long.parseLong(Unknown Source) at java.lang.Long.valueOf(Unknown Source) at org.springframework.integration.config.xml.IntegrationNamespaceUtils.createIntervalTrigger(IntegrationNamespaceUtils.java:164) at org.springframework.integration.config.xml.IntegrationNamespaceUtils.configureTrigger(IntegrationNamespaceUtils.java:149) at org.springframework.integration.config.xml.AbstractPollingInboundChannelAdapterParser.doParse(AbstractPollingInboundChannelAdapterParser.java:45) at org.springframework.integration.config.xml.AbstractChannelAdapterParser.parseInternal(AbstractChannelAdapterParser.java:58) at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:56) at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398) The config file looks like this (the directory placeholder resolves just fine): < file:inbound-channel-adapter directory="file:${adaptation.hwimport.pdf.directory}" filter="adaptation.hwimport.pdf.compositeFilter" channel="adaptation.hwimport.pdf.filesInChannel" > <si:poller max-messages-per-poll="100"> <si:interval-trigger interval="${adaptation.hwimport.pdf.pollPeriod} "/> </si:poller> </ file:inbound-channel-adapter >
          Hide
          Mark Fisher added a comment -

          I'm reopening this issue since the placeholders do not apply to pollers (as shown in the previous comment).

          The problem is that those pollers are not being created as BeanDefinitions, and so the BeanFactoryPostProcessor does not apply to them.

          Instead of creating the Trigger instances and setting directly as property values in the parsing process, we need to create BeanDefinitions and set the property reference.

          Show
          Mark Fisher added a comment - I'm reopening this issue since the placeholders do not apply to pollers (as shown in the previous comment). The problem is that those pollers are not being created as BeanDefinitions, and so the BeanFactoryPostProcessor does not apply to them. Instead of creating the Trigger instances and setting directly as property values in the parsing process, we need to create BeanDefinitions and set the property reference.
          Hide
          Mark Fisher added a comment -

          The property placeholder values can now be applied to trigger configurations.

          See the commit log for details:
          https://fisheye.springframework.org/changelog/spring-integration?cs=1714

          Show
          Mark Fisher added a comment - The property placeholder values can now be applied to trigger configurations. See the commit log for details: https://fisheye.springframework.org/changelog/spring-integration?cs=1714

            People

            • Assignee:
              Mark Fisher
              Reporter:
              Martti von Hertzen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: