Merge pull request #5526 from khatwaniNikhil/BAEL-2215
Changes for BAEL-2215
This commit is contained in:
commit
c26630f046
|
@ -16,5 +16,6 @@ public class CollectionInjectionDemo {
|
||||||
collectionsBean.printNameSet();
|
collectionsBean.printNameSet();
|
||||||
collectionsBean.printNameMap();
|
collectionsBean.printNameMap();
|
||||||
collectionsBean.printBeanList();
|
collectionsBean.printBeanList();
|
||||||
|
collectionsBean.printNameListWithDefaults();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package com.baeldung.collection;
|
package com.baeldung.collection;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Gebruiker on 5/18/2018.
|
* Created by Gebruiker on 5/18/2018.
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +25,9 @@ public class CollectionsBean {
|
||||||
@Qualifier("CollectionsBean")
|
@Qualifier("CollectionsBean")
|
||||||
private List<BaeldungBean> beanList = new ArrayList<>();
|
private List<BaeldungBean> beanList = new ArrayList<>();
|
||||||
|
|
||||||
|
@Value("${names.list:}#{T(java.util.Collections).emptyList()}")
|
||||||
|
private List<String> nameListWithDefaultValue;
|
||||||
|
|
||||||
public CollectionsBean() {
|
public CollectionsBean() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,4 +55,8 @@ public class CollectionsBean {
|
||||||
public void printBeanList() {
|
public void printBeanList() {
|
||||||
System.out.println(beanList);
|
System.out.println(beanList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void printNameListWithDefaults() {
|
||||||
|
System.out.println(nameListWithDefaultValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue