<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
<bean id="car" class="com.Greatest.Spring2.dbutil.Car" >
<property name="brand" value="#{'路虎揽胜'}" ></property>
<property name="price" value="#{car.brand ne '路虎揽胜'? 100000:200000}" ></property>
<!-- <property name="price" value="#{456*2.0}" ></property>
LE小于等于 lt小于 gt大于 eq等于 ne不等于 -->
<!-- 调用静态方法或静态属性:通过 T() 调用一个类的静态方法,它将返回一个 Class Object,然后再调用相应的方法或属性:
-->
<property name="maxSpeed" value="#{T(java.lang.Math).PI^5}" ></property>
<!-- <property name="fat" value="#{true}"></property> -->
<!--返回值是布尔类型的 <property name="fat" value="#{car.price eq 10000}"></property> -->
<property name="fat" value="#{car.price==100000 or car.maxSpeed>10}"></property>
</bean>
<bean id="person" class="com.Greatest.Spring2.dbutil.Person">
<property name="name" value='#{car.toString()+" "+car.price+""}'></property>
<property name="car" value="#{car}"></property>
</bean>
</beans>
SpringEL表达式
猜你喜欢
转载自blog.csdn.net/qq_42676998/article/details/83348030
今日推荐
周排行