1. What is Spring Boot?
o Spring Boot is a framework built on top of Spring that simplifies the setup and
development of new Spring applications by providing default configurations and
reducing boilerplate code.
2. What are the important Goals of Spring Boot?
o Simplify Spring application development.
o Provide production-ready defaults and configurations.
o Eliminate the need for extensive XML configuration.
o Enable faster and easier development with embedded servers.
3. What are the important Features of Spring Boot?
o Auto-configuration.
o Embedded web servers (like Tomcat, Jetty).
o Starter dependencies.
o Actuator for monitoring.
o Spring Initializr for bootstrapping projects.
4. Compare Spring Boot vs Spring?
o Spring requires manual configuration.
o Spring Boot offers auto-configuration and embedded server.
o Spring Boot is opinionated and convention-driven.
5. Compare Spring Boot vs Spring MVC?
o Spring MVC is a module for building web applications.
o Spring Boot can use Spring MVC internally and simplifies its setup.
6. What is the importance of @SpringBootApplication?
o It is a convenience annotation that combines @Configuration,
@EnableAutoConfiguration, and @ComponentScan.
7. What is Auto Configuration?
o It automatically configures Spring Beans based on classpath settings, properties, and
beans defined by the user.
8. How can we find more information about Auto Configuration?
o Use spring-boot-actuator or run with --debug flag.
o Check META-INF/spring.factories in starter jars.
9. What is an embedded server? Why is it important?
o An embedded server (e.g., Tomcat) runs inside the application JAR/WAR. It simplifies
deployment and testing.
10. What is the default embedded server with Spring Boot?
o Tomcat.
11. What are the other embedded servers supported by Spring Boot?
o Jetty and Undertow.
12. What are Starter Projects?
o Pre-configured Maven or Gradle dependencies for common use cases (e.g., spring-
boot-starter-web).
13. Can you give examples of important starter projects?
o spring-boot-starter-web, spring-boot-starter-data-jpa, spring-boot-starter-security,
spring-boot-starter-test.
14. What is Starter Parent?
o A parent POM that provides default dependency versions and configurations.
15. What are the different things that are defined in Starter Parent?
o Java version, dependency versions, encoding, plugin configurations, etc.
16. How does Spring Boot enforce common dependency management for all its Starter
projects?
o Through dependency management in the starter parent POM.
17. What is Spring Initializr?
o A web-based tool (https://start.spring.io) to generate Spring Boot project skeletons.
18. What is application.properties?
o A file to configure Spring Boot application settings.
19. What are some of the important things that can customized in application.properties?
o Server port, datasource URL, logging level, security, profiles, etc.
20. How do you externalize configuration using Spring Boot?
o By placing application.properties or application.yml outside the JAR or using
environment variables.
21. How can you add custom application properties using Spring Boot?
o Define them in application.properties and bind them using @Value or
@ConfigurationProperties.
22. What is @ConfigurationProperties?
o It binds external configuration to a Java Bean class.
23. What is a profile?
o A way to segregate configuration and beans based on environments like dev, test,
prod.
24. How do you define beans for a specific profile?
o Use @Profile("dev") on configuration classes or bean methods.
25. How do you create application configuration for a specific profile?
o Create property files like application-dev.properties and activate using
spring.profiles.active=dev.
26. How do you have different configuration for different environments?
o By using profile-specific property files and @Profile annotations.
27. What is Spring Boot Actuator?
o A module that provides production-ready features like health checks, metrics, and
environment info.
28. How do you monitor web services using Spring Boot Actuator?
o Enable endpoints like /actuator/health, /actuator/metrics, etc.
29. How do you find more information about your application environment using Spring Boot?
o Access /actuator/env or use Environment object.
30. What is a CommandLineRunner?
o An interface that runs a block of code after the Spring Boot application starts. Useful
for initialization logic.
o @Component
o public class MyRunner implements CommandLineRunner {
o public void run(String... args) {
o System.out.println("App Started");
o }
o }