Spring Expression Language
the syntax to designate a Spring expression for evaluation at runtime is #{ “SpEL expression string”}
#{systemProperties['system.propery.flag'] ?: false }
#{itemBean}
#{itemBean.name}
@Value("#{itemBean}")
@Value("#{itemBean.name}")
@Value("#{'Thomas Lake Drive'}")
@Value("#{55121}")
@Value("#{systemProperties['os.arch'].equals('x86')? winDataSource : unixDataSource}")
METHOD FACTORY WIRING
@Value("#{fileService.createFile()}")
private File file;
STATIC METHOD WIRING
@Value("#{ T(Math).random()}")
private double powerLevel;
#{otherBean.method().length()}
#{T(java.lang.Integer).MIN_VALUE}
How to avoid exceptions
Instead of a single period (.) you need to precede a period with a question mark (?).
<property name="prop" value="#{otherBean.method()?.toUpperCase()}"/>
#{otherBean.method() != null ? otherBean.method().length() : -1}
Regular Expressions - tru/false
<property name="onlyDigits" value="#{otherMean.method() matches '\d+'}" />
Collection selection can have another syntax.
<property name="topSubjects" value="#{subjectList.?[id gt 111 and id lt 113]}"/>
<property name="mycity" value="#{cities[2]}"/>
Arithmetic Operations
<property name="mrp"value="#{counter.total+25}"/>
http://ift.tt/1KS4QYr
http://ift.tt/1ixN95p
http://ift.tt/1KS4QYt
the syntax to designate a Spring expression for evaluation at runtime is #{ “SpEL expression string”}
#{systemProperties['system.propery.flag'] ?: false }
#{itemBean}
#{itemBean.name}
@Value("#{itemBean}")
@Value("#{itemBean.name}")
@Value("#{'Thomas Lake Drive'}")
@Value("#{55121}")
@Value("#{systemProperties['os.arch'].equals('x86')? winDataSource : unixDataSource}")
METHOD FACTORY WIRING
@Value("#{fileService.createFile()}")
private File file;
STATIC METHOD WIRING
@Value("#{ T(Math).random()}")
private double powerLevel;
#{otherBean.method().length()}
#{T(java.lang.Integer).MIN_VALUE}
How to avoid exceptions
Instead of a single period (.) you need to precede a period with a question mark (?).
<property name="prop" value="#{otherBean.method()?.toUpperCase()}"/>
#{otherBean.method() != null ? otherBean.method().length() : -1}
Regular Expressions - tru/false
<property name="onlyDigits" value="#{otherMean.method() matches '\d+'}" />
Collection selection can have another syntax.
<property name="topSubjects" value="#{subjectList.?[id gt 111 and id lt 113]}"/>
<property name="mycity" value="#{cities[2]}"/>
Arithmetic Operations
<property name="mrp"value="#{counter.total+25}"/>
http://ift.tt/1KS4QYr
http://ift.tt/1ixN95p
http://ift.tt/1KS4QYt
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1ixN95t
via LifeLong Community
No comments:
Post a Comment