DEV Community

Discussion on: Lazy Beans in Spring

Collapse
kriska profile image
Kristina Gocheva

You've described very briefly the lazy annotation and its effect. I would like to understand why you said that it's usages is not recommended. Some additional examples would be helpful.

Collapse
eidher profile image
eidher Author

I won't recommend its use because we could mask issues, getting them in run time instead of startup time (out of memory errors, misconfigurations, or class-definition-found errors). Besides, triggering bean creation on demand will increase the latency of HTTP requests impacting load balancing and autoscale in cloud environments.