BAEL-748 updated Quick Guide to @Value (#1663)

* BAEL-748 quick guide to @Value

* BAEL-748 changes from review

* BAEL-748 inject comma-separated values into array
This commit is contained in:
Anton 2017-04-19 06:36:43 +03:00 committed by yetanotherallisonf
parent 74688cf30e
commit f674f12eac
1 changed files with 5 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package com.baeldung.value; package com.baeldung.value;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@ -30,6 +31,9 @@ public class ValuesApp {
@Value("${priority}") @Value("${priority}")
private String prioritySystemProperty; private String prioritySystemProperty;
@Value("${listOfValues}")
private String[] valuesArray;
@Value("#{systemProperties['priority']}") @Value("#{systemProperties['priority']}")
private String spelValue; private String spelValue;
@ -60,6 +64,7 @@ public class ValuesApp {
System.out.println(systemValue); System.out.println(systemValue);
System.out.println(someDefault); System.out.println(someDefault);
System.out.println(prioritySystemProperty); System.out.println(prioritySystemProperty);
System.out.println(Arrays.toString(valuesArray));
System.out.println(spelValue); System.out.println(spelValue);
System.out.println(spelSomeDefault); System.out.println(spelSomeDefault);
System.out.println(someBeanValue); System.out.println(someBeanValue);