PDA

View Full Version : Properties in xml configuration of spring integration



marwan simaan
Aug 11th, 2008, 02:40 AM
Hi,

I want to use properties that I load (from a properties file let's say) using:
<bean class="org.springframework.beans.factory.config.PropertyP laceholderConfigurer">
<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

iwein
Aug 11th, 2008, 04:25 AM
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
<context:property-placeholder/> ?

marwan simaan
Aug 11th, 2008, 04:36 AM
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? :)

Mark Fisher
Aug 11th, 2008, 07:14 AM
There is an open issue for this in JIRA, so you can add your vote: http://jira.springframework.org/browse/INT-302

iwein
Aug 11th, 2008, 07:46 AM
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.

Mark Fisher
Aug 11th, 2008, 08:28 AM
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