Question: What is the purpose of the @Lazy annotation and why would you use it?
- It prevents a bean from being created and injected until you run a specific CLI command. It reduces complexity in the application.
- It can be applied to a bean so that the bean is not persisted in the database. It reduces the number of database operations.
- It can be applied to a bean so that the bean is not created and injected until it is needed. It can help speed up startup time for your application.
- It prevents a bean from being created and injected until it receives a HTTP request to a callback hook. It reduces disk footprint.
Answer: The correct answer of the above question is Option C:It can be applied to a bean so that the bean is not created and injected until it is needed. It can help speed up startup time for your application.