Some Frequently asked question in Spring boot

 Here are 28 Spring Boot–focused interview questions, one for each of your listed topics:

  1. @Qualifier
    How does the @Qualifier annotation work in Spring, and when would you use it to resolve bean conflicts?

  2. @Profile
    Explain the purpose of the @Profile annotation in Spring Boot and give an example of how to enable a bean only under a specific profile.

  3. Controller vs. @RestController
    What’s the difference between @Controller and @RestController in Spring Boot, and when should you use each?

  4. @SuppressWarnings
    What is the use of the @SuppressWarnings annotation in Java, and how might you apply it in a Spring Boot project?

  5. Default Values in application.properties
    How can you specify default values for configuration properties in application.properties (or YAML) and override them at runtime?

  6. Bean Scopes
    What are the different bean scopes available in Spring (e.g., singleton, prototype), and how do they affect bean instantiation and lifecycle?

  7. Spring vs. Spring MVC vs. Spring Boot
    Compare the core Spring Framework, Spring MVC, and Spring Boot in terms of setup, configuration, and typical use cases.

  8. Custom Exception
    How do you define and throw a custom exception in Spring Boot, and how would you return a meaningful error response to the client?

  9. Debugger
    What tools and techniques do you use to debug a Spring Boot application locally or in a remote environment?

  10. @ControllerAdvice (Global Exception Handling)
    How does @ControllerAdvice work in Spring Boot, and how can you use it to implement global exception handling?

  11. ExceptionHandler per Controller
    How do you handle exceptions differently in separate controller classes using @ExceptionHandler?

  12. final Initialization
    When and why would you mark a field or method as final in your Spring Boot components?

  13. Interface Variable Declaration
    Can you declare variables in a Java interface? How does that feature play into designing Spring Boot applications?

  14. Benefits of Spring Boot over Spring
    What are the key advantages of Spring Boot compared to the traditional Spring Framework?

  15. Spring Batch
    What is Spring Batch, and in what scenarios would you choose it over plain JDBC or other ETL tools?

  16. YAML in Spring Boot
    How do you structure and load configuration using a YAML (.yml) file in Spring Boot?

  17. Interceptor in Spring Boot
    What is a Spring Boot interceptor, how do you register one, and how does it differ from a filter?

  18. Actuator
    What is Spring Boot Actuator, and which built-in endpoints would you use to monitor application health and metrics?

  19. @Inject vs. @Autowired
    How does @Inject (JSR-330) compare to Spring’s @Autowired annotation in dependency injection?

  20. Editing Properties at Runtime
    Is it possible to modify application.properties values while a Spring Boot app is running? If so, how?

  21. Spring Starter
    What is a “starter” dependency in Spring Boot, and how do starters simplify building applications?

  22. Components of Spring
    What are the primary modules (e.g., Core, AOP, Data) that Spring Boot builds on, and what role does each play?

  23. CrudRepository vs. JpaRepository
    What’s the difference between CrudRepository and JpaRepository in Spring Data JPA, and when would you choose one over the other?

  24. Changing the Server
    How do you change the embedded server’s port, context path, or servlet container (e.g., from Tomcat to Jetty) in Spring Boot?

  25. Yammer Metrics in Actuator
    What role did the Yammer metrics library play in earlier versions of Spring Boot Actuator, and how has metrics support evolved?

  26. RestTemplate
    How does RestTemplate work in Spring Boot for making HTTP calls, and what newer alternative does Spring recommend?

  27. Validation
    How do you implement request data validation in Spring Boot using Hibernate Validator (JSR-380) annotations?

  28. Transaction Rollback
    How would you configure a Spring Boot service method so that database changes roll back automatically when an exception occurs?

Comments

Popular Posts