How to do arithmetic in Spring properties? How to do arithmetic in Spring properties? xml xml

How to do arithmetic in Spring properties?


You didn't mention which version of Spring you're using, but Spring 3.0 comes with Spring EL (Expression Language) which allows you to use expressions in the XML bean definitions (as well as other places, such as @Value annotations).

<util:properties id="properties" location="classpath:jobs.properties"/><bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">    <property name="jobDetail" ref="Job1" />    <property name="repeatInterval" value="#{ 1000 / properties['jobs.per.second'] * 100.0 }" /></bean>

You can read more about Spring EL here