Question: What is the purpose of the @Lazy annotation and why would you use it?

  1. It prevents a bean from being created and injected until you run a specific CLI command. It reduces complexity in the application.
  2. It can be applied to a bean so that the bean is not persisted in the database. It reduces the number of database operations.
  3. 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.
  4. 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.