posted 9 years ago
We know that if parent bean is in singleton scope , then the child bean also is in singleton, even if you set the child bean scope as prototype in configuration xml. Now we implement ApplicationContextAware in parent bean and try to get the child bean object using the ApplicationContext object injected by spring container in the setApplicationContext(ApplicationContext appContext) overriden method.
Question 1: Do we get a new object of the child bean or the same singleton chile bean object created by container while loading the parent bean ?
Question 2: If we do not get a new object of the child bean, is there any way to make the child bean behave like propotype so that we get a new object every time for a new request/get bean call ?