Like in subject. I didn't see any difference between those approaches. Prototype bean is clear when I use only those. But in spring we base on the singleton's beans so when I use bean with scope prototype in singleton bean it look the same like I want to create new Object.
@Service
public class SomeService{
@Autowired
private ApplicationContext applicationContext;
public void someClass() {
PrototypeObject prototypeObject = applicationContext.getBean(PrototypeObject .class);
PrototypeObject prototypeObject = new PrototypeObject();
}
}
Is there a difference between those two approaches?
The best answer for me is: I lost any advantages of IoC.