I am trying to inject a prototype
bean in a singleton
bean such that every new call to a singleton bean method has a new instance of the prototype
Since Spring 4.1 you can use annotation @Lookup
@Lookup
public PrototypeBean getPrototypeBean() {
return null;
}
Every time you will call method getPrototypeBean() - you will receive new prototype bean instance. Don't worry about empty method realization: Spring will override it for you.
Read more in official documentation.