set bean names

This commit is contained in:
mherbaghinyan 2018-05-30 22:19:06 +04:00
parent fa60d4e69e
commit 834be9a720
2 changed files with 14 additions and 3 deletions

View File

@ -4,4 +4,15 @@ package com.baeldung.collection;
* Created by Gebruiker on 5/22/2018.
*/
public class BaeldungBean {
private String name;
public BaeldungBean(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}

View File

@ -33,18 +33,18 @@ public class CollectionConfig {
@Qualifier("CollectionsBean")
@Order(2)
public BaeldungBean getElement() {
return new BaeldungBean();
return new BaeldungBean("John");
}
@Bean
@Order(3)
public BaeldungBean getAnotherElement() {
return new BaeldungBean();
return new BaeldungBean("Adam");
}
@Bean
@Order(1)
public BaeldungBean getOneMoreElement() {
return new BaeldungBean();
return new BaeldungBean("Harry");
}
}