I have used Pre-loading in spring framework,so my beans are created when loaded in container. My beans instances are singleton. But I want to use lazy loading. To my understanding, when using lazy loading beans' instances are created when the bean is requested, but is not present in the container.
But my requirement is when the operation on that bean finishes, I want to garbage collect that bean instance. And again, when that bean is requested I want to create the bean again in lazy loading way.
So, as far as I know when beans are deployed in container again to create beans instance after bean instance is garbage collected, we have to redeploy it in the container. I want to garbage collect bean instance at runtime after it is used, and create its instance again when it is requested. Is it possible using spring and tomcat without redeploying?