七SpEl表达式
来源:互联网 发布:万方数据库中检索字段 编辑:程序博客网 时间:2024/06/08 01:27
语法类似于 EL:SpEL 使用 #{…} 作为定界符,所有在大框号中的字符都将被认为是 SpEL
通过 SpEL 可以实现:
通过 bean 的 id 对 bean 进行引用
调用方法以及引用对象中的属性
计算表达式的值
正则表达式的匹配
ex:
配置一个bean,并赋上字面值:
SpEl的基本操作:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="address" class="autowire.Address"> <property name="city" value="#{'wuxi'}"></property> <property name="street" value="Binghujie"></property> <property name=“name” value="#{'Chuck'}"/> <property name="enabled" value="#{false}"/> </bean></beans>引用其他的对象: <property name="a" value="#{prefixGenerator}"></property>引用其他对象的属性:<property name="b" value="#{prefixGenerator.a}"></property>调用其他方法:<property name="c" value="#{prefixGenerator.toString()}"></property>链式调用:<property name="c" value="#{prefixGenerator.toString().toUpperCase()}"></property>if else运算符:<property name="info" value="#{car.price>300000?'金领':'白领'}"></property>正则:<property name='zz' value="#{admin.email matches '正则表达式'}"/>调用静态方法或者静态属性:<property name="pri" value="#{T(java.lang.Math).PI*80}"></property>
0 0
- 七SpEl表达式
- spel表达式
- SpEL表达式
- SpEl表达式
- SpEL表达式
- SpEL表达式
- 深入学习Spring框架之七SpEL表达式装配
- Spring Security3 SpEL表达式
- Spring SpEL表达式
- SPEL-Spring表达式
- spring的SpEl表达式
- Spring SpEL表达式
- spel表达式解析
- spring表达式语言spel
- Spring 表达式语言(SpEL)
- 初学SpEL表达式
- Spring表达式语言SpEL
- Spring 表达式语言 (SpEL)
- Duplicate Symbol链接问题总结
- Excel JDBC 上手Demo
- Android:用SharePreferences实现记住密码功能 (登陆案例)
- Servlet 知识总结
- 不正经运维狗的习题10
- 七SpEl表达式
- 题目1026:又一版 A+B
- Linux系统编程——进程替换:exec 函数族
- Ajax基本案例详解之load的实现
- JAVA面向对象的三大特点
- opencv 函数(一)
- Mybatis介绍之参数传递
- FU-A分包方式,以及从RTP包里面得到H.264数据和AAC数据的方法
- HDU 5381 The sum of gcd