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:
parent
74688cf30e
commit
f674f12eac
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue