Is it possible to get a prototype bean from Spring Context without creating a new bean every time? -
I have a servlet, which needs to get information from prototype bean. However, I do not want to get a new bean, servlet is running. So far, I still could not find a way to do this. In spring, the beans have two basic types, single songs or prototypes, if you have a singleton, which If the default is, the spring will make an example as the application reference is booted, and all the references to this bean will return this one example if the bean is a prototype, then complete all its references with a new instance in the context Will be done. However, your question is unclear if you mean that you have a bean, which is usually a prototype but for a particular use you want to treat it as a singleton , Then why not use two beans, the same type, as a singleton and as a prototype, and the qualifier to distinguish between two.