Pergunta de entrevista da empresa Infosys

What is the difference between @Component, @Service, and @Repository in Spring Boot? Why do we need separate stereotypes if they all behave similarly for component scanning? 2. How does Spring handle dependency injection? Explain constructor injection vs setter injection and which one is recommended and why. 3. What is the difference between EntityManager and Hibernate Session? When would you use one over the other? 4. How does Spring Boot auto-configuration work? Explain the role of spring.factories and @EnableAutoConfiguration. 5. Explain the lifecycle of a Spring Bean. What are @PostConstruct and @PreDestroy, and when would you use them?