原文链接:http://www.yiidian.com/spring/spring-el-method.html
SpEL允许开发者用El运行方法函数,并且允许将方法返回值注入到属性中。
一、编写Bean类
TestMethod类
package com.yiidian;
/**
*
* @author http://www.yiidian.com
*
*/
public class TestMethod {
public Double getPrice(){
return 199.99D;
}
}
Customer类:
package com.yiidian.domain;
import java.io.Serializable;
/**
*
* @author http://www.yiidian.com
*
*/
public class Customer implements Serializable{
private String name;
private Double amount;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount =