Results 1 to 6 of 6

Thread: Properties in xml configuration of spring integration

  1. #1

    Default Properties in xml configuration of spring integration

    Hi,

    I want to use properties that I load (from a properties file let's say) using:
    <bean class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="location" value="classpath:file.properties"/>
    </bean>

    In some attributes in spring integration ,where you have a type check, I can't seem to use a variable. One example is the period attribute of the schedule element which is expected to be an integer. This prevents me from using a variable like ${poll.period}.

    Is there another way to go around this?

    Thanks,
    Marwan

  2. #2
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    The hard way around would be to define the component as a bean instead of using the namespace. The easy way (for you) would be to convince the developers that the convenience of property placeholders outweighs the safety of type checking in xml.

    If we remove the restriction from the xsd there would be no problem of course.

    Almost completely off-topic: did you check out
    Code:
    <context:property-placeholder/>
    ?
    Last edited by iwein; Aug 11th, 2008 at 07:38 AM. Reason: using the code tags like a good boy :p

  3. #3

    Default

    I will try the piece of code you sent.

    So I get from your reply that the easy way (for me) is out of the question?

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    There is an open issue for this in JIRA, so you can add your vote: http://jira.springframework.org/browse/INT-302

  5. #5
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    Quote Originally Posted by marwan simaan View Post
    So I get from your reply that the easy way (for me) is out of the question?
    No no, as Mark mentioned, we do take you seriously and you're not alone. If pressured to take sides I'd probably side with you on this one.

  6. #6
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Also, this same general issue is on the roadmap for the Spring core: http://jira.springframework.org/browse/SPR-3180

    While losing the type-safety at the level of the XSD is unfortunate, the flexibility of using placeholders for common configuration elements that happen to be numeric or boolean is probably more important.

    -Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •