java - ternary operator in spring configuration file -
i have situation need check profile maven running on , according need configure task scheduler. there 2 profiles 1 'global' , other 1 'nonglobal', did is:
<task:scheduler id="customerportaltaskscheduler" pool-size="1" /> <task:scheduled-tasks scheduler="customerportaltaskscheduler"> <task:scheduled ref="subscriptionservice" method="updatenextdistributiondateforallcurrentusers" cron="${nhst.ncp.instance} == 'global' ? #{customerportal['globalupdatedistributiondateservicetuesday.crontrigger']} : #{customerportal['updatedistributiondateservicemondaythursday.crontrigger']}" /> <task:scheduled ref="subscriptionservice" method="updatenextdistributiondateforallcurrentusers" cron="${nhst.ncp.instance} == 'global' ? #{customerportal['globalupdatedistributiondateservicewednesday.crontrigger']} : #{customerportal['updatedistributiondateservicefriday.crontrigger']}" /> <task:scheduled ref="subscriptionservice" method="updatenextdistributiondateforallcurrentusers" cron="${nhst.ncp.instance} == 'global' ? #{customerportal['globalupdatedistributiondateservicethursday.crontrigger']} : #{customerportal['updatedistributiondateserviceweekend.crontrigger']}" /> </task:scheduled-tasks> ${nhst.ncp.instance} instance of maven profile. whether global or nonglobal profile. work fine, because properties file being loaded properly.
with above configuration, getting error there in screenshot.
any ideas how solve this?
do not depend on profile activated. depend on local configuration file:
<context:property-placeholder ignore-resource-not-found="true" location="file:/etc/mumbojumbo/app.config.properties"/> in /etc/mumbojumbo/app.config.properties
cron.schedule = blabla you can provide sensible default value. have override want.
<task:scheduled ref="subscriptionservice" method="updatenextdistributiondateforallcurrentusers" cron="${cron.schedule:defaultvalue}" /> something that?
Comments
Post a Comment