Spring式言語


メソッド内の属性や引数を定義する暗黙の参照として使用できます.
@Value("#{ systemProperties['user.region'] }") String defaultLocale;
SPELはスプリングBeanにアクセスできます.
@Value("#{beanId.method}") BeanType param;
SPELは文字列としてプロパティにアクセスできます(キャスティングが必要です).
@Value("${property1}") int property1;
@Value("#{environment['property2']}") int property2;
@Value("#{new Integer(environment['property3'])*2}") int property3;
未定義の使用spelでデフォルト値を代入します.
@Value("${property1 : 1}") int property1;
@Value("#{environment['property2'] ?: 1}") int property2;