Spring Boot Frequently Asked Questions
Since his creation, Spring Boot has caused a sensation in the industry. Today, more and more companies are choosing to adopt Spring Boot framework in their projects. So Spring Boot has become one of the unavoidable questions that must be asked during the interview. Happy Reading!

Q1: What is the difference between Spring and Spring Boot?
The Spring Framework provides several features that make web application development easier. These features include dependency injection, data binding, aspect-oriented programming, data access, and more.
As the Spring community grew, Spring slowly became more complex and no longer as lightweight as it began to claim. The increasing amount of configuration for developing applications is a headache for developers. At this point, Spring Boot comes in handy-it simplifies configuration with the idea of ”Convention is greater than configuration”, abstracts some of the features and configuration provided by Spring into a “Starter” out of the box, and references it on demand. Greatly simplified development.

Q2: What is the starter in Spring boot?
Dependency management is critical to the project. When a project is complex enough, managing dependencies can become a nightmare because there are too many components involved.
This is where Spring Boot’s starter comes in handy. Each starter can provide us with one-stop service of the required Spring technology. And pass and manage other required dependencies in a consistent way.
There are currently more than 50 official starters. The most commonly used are:
- spring-boot-starter: Core starter, including auto-configuration support, logging, and YAML
- spring-boot-starter-aop: Beginner for aspect-oriented programming with Spring AOP and AspectJ
- spring-boot-starter-data-jpa: Starter using Spring Data JPA and Hibernate
- spring-boot-starter-jdbc: starter for using JDBC with HikariCP connection pool
- spring-boot-starter-security: Starter using Spring Security
- spring-boot-starter-test: starter for testing Spring Boot applications
- spring-boot-starter-web: Starter for building web with Spring MVC, including RESTful applications
Other starters can go to spring.io
Q3: What external configurations does Spring boot support?
Spring Boot supports external configuration, allowing us to run the same application in various environments. We can use properties files, YAML files, environment variables, system properties, and command-line option parameters to specify configuration properties.
We can then access these properties using the @Value annotation, via the @ConfigurationProperties annotation of the bound object, or the Environment abstract class injection.
Here are the most common sources of external configuration:
- Command-line attributes: Command-line option parameters are program parameters that begin with a double hyphen, such as -server.port = 8080 . Spring Boot converts all parameters to attributes and adds them to the environment attribute set.
- Application properties: Application properties are properties loaded from the application.properties file or its YAML counterpart. By default, Spring Boot searches for this file in the current directory, classpath root, or its config subdirectory.
- Profile-specific properties: Profile- specific properties are loaded from the application- {profile} .properties file or its YAML counterpart. The {profile} placeholder refers to the active profile. These files are in the same location as the non-specific properties file and take precedence over the non-specific properties file.
Q4: How to run some logic when Spring Boot starts?
You can implement the interface ApplicationRunner provided by Spring Boot or the interface CommandLineRunner. The two interfaces are implemented in the same way; they only provide a run method.
What is the difference between testing in Spring and in Spring Boot?
When running integration tests for Spring applications, we must have an ApplicationContext.
To simplify testing, Spring Boot provides a special annotation @SpringBootTest for testing. This annotation creates an ApplicationContext from the configuration class indicated by its classes attribute.
If the classes attribute is not set, Spring Boot will search for the main configuration class. The search starts with the package containing the test until it finds a class annotated with @SpringBootApplication or @SpringBootConfiguration.
Note that if we use JUnit 4, we must decorate the test class with @RunWith (SpringRunner.class).
Q5: What’s the use of the Spring Boot Actuator?
Spring Boot Actuator can help you monitor and manage Spring Boot applications, such as health checks, auditing, statistics, and HTTP tracking.
Actuator can also integrate with external application monitoring systems, such as Prometheus, Graphite, DataDog, Influx, Wavefront, New Relic, etc. These systems provide excellent dashboard, icon, analysis, and alarm functions so that you can easily monitor and manage your applications through a unified interface.
Actuator uses Micrometer to integrate the external application monitoring system mentioned above. This makes it possible to integrate any application monitoring system with a minimal configuration.
Integrating Spring Boot Actuator into a project is very simple. All we need to do is include the spring-boot-starter-actuator starter in the pom.xml file.
Spring Boot Actuator can expose operation information using HTTP or JMX endpoints. However, most applications use HTTP, where the endpoint's identity and the / executor prefix form the URL path.
Here are some of the most common built-in endpoints provided by Actuator:
- auditevents: Public audit event information
- env: expose environment properties
- health: Display application health information
- httptrace: Display HTTP trace information
- info: display any application information
- metric: display metric information
- mapping: display a list of all @RequestMapping paths
- scheduledtasks: show scheduled tasks in the application
- threaddump: Perform a thread dump
- beans: all loaded spring beans
Actuator must be used in production to protect these endpoints from unauthorized access requests.
I hope it will help you!
Thank you for your time. I hope you got interesting stuff for you and enjoyed the reading.
✉ Let’s keep in touch! Sign up for my weekly newsletter
❤ If you liked this post, you might also love: