Is it possible to create prototype beans using some pattern in @Value annotation with properties / yaml configuration?
There is an example what I mean:
Example object:
@Component
@Scope("prototype")
public class SomeObject {
@Value("${someobject.key.name}")
String name;
@Value("${someobject.key.address}")
String address;
@Value("${someobject.key.phone}")
int phone;
getters and setters
}
Example properties:
someobject.first.name = Phil
someobject.first.address = Berlin
someobject.first.phone = 123
someobject.second.name = Bill
someobject.second.address = New-York
someobject.second.phone = 321
I need to create two prototype beans
first with key "first"
second with key "second"
Ideal - if they will initialized like singletons on startup application