How to do arithmetic in Spring properties?

前端 未结 1 1752
余生分开走
余生分开走 2021-02-19 18:15

        
        &l         


        
相关标签:
1条回答
  • 2021-02-19 19:04

    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

    0 讨论(0)
提交回复
热议问题