Spring,MyBatis 실무 과정 자료] SpEL사용예
Spring,MyBatis 실무 과정 자료] SpEL사용예
실무개발자를위한 실무교육 전문교육센터학원
www.oraclejava.co.kr에 오시면 보다 다양한 강좌를 보실 수 있습니다.
SpEL사용예
■ SpEL사용예
Spring XML 설정파일
<bean id="numberGuess" class="org.spring.samples.NumberGuess">
<property name="randomNumber" value="#{ T(java.lang.Math).random() * 100.0 }"/>
<!-- other properties -->
</bean>
Spring XML 설정파일(시스템 프러퍼티 호출)
<bean id="taxCalculator" class="org.spring.samples.TaxCalculator">
<property name="defaultLocale" value="#{ systemProperties['user.region'] }"/>
<!-- other properties -->
</bean>
■ 자바파일(어노테이션)
public static class FieldValueTestBean
@Value("#{ systemProperties['user.region'] }")
private String defaultLocale;
public void setDefaultLocale(String defaultLocale) {
this.defaultLocale = defaultLocale;
}
public String getDefaultLocale() {
return this.defaultLocale;
}
}
'자바 > Spring' 카테고리의 다른 글
Spring,MyBatis 실무 과정 자료] ServletAPI에서의 세션 관리 (0) | 2017.04.21 |
---|---|
Spring,MyBatis 실무 과정 자료] 스코프의 종류 (0) | 2017.04.21 |
Spring,MyBatis 실무 과정 자료] SpEL메서드 호출 (0) | 2017.04.21 |
Spring,MyBatis 실무 과정 자료] SpEL속성 접근 (0) | 2017.04.21 |
Spring,MyBatis 실무 과정 자료] SpEL 연산자 (0) | 2017.04.21 |