Spring Expression Language

載入IP參數, 轉成List

ip.list=192.168.56.101,192.168.56.102

@Value("#{'${ip.list}'==''?null:'${ip.list}'.split(',')}") 空參數值→轉成Null
or
@Value("#{'${ip.list}'==''?T(java.util.Collections).emptyList():'${ip.list}'.split(',')}") 空參數值→轉成Empty List
private List<String> ipList;

Continue reading Spring Expression Language

Advertisements