Thanks, that'd do for a field of a class.
How about if i want to do this inside a local method, where it's not declared as a field ?
For example :
Code:
public void addToMyList(String s, int i) {
DomainModel model = new DefaultDomainModelImpl(); // it's hardcoding the implementation here
model.setName(s).setAge(i);
myList.add(model);
}
Frankly, im beginning to think that this is a wrong question for spring, since my case is not about wiring object dependencies, but rather about instantiation of specific implementations that can be solved with autowiring factories.
Any extra thoughts ?