Master Spring Boot: Core Concepts, Configuration, and Top Interview Questions

This article compiles essential Spring Boot interview questions, covering its definition, benefits, core configuration files, starter modules, auto‑configuration, embedded containers, actuator monitoring, security concerns, exception handling, differences from Spring MVC, and integration with tools like ELK and Docker.

Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Master Spring Boot: Core Concepts, Configuration, and Top Interview Questions

What is Spring Boot?

Spring Boot is a sub‑project of the Spring open‑source organization that simplifies the initial setup and development of new Spring applications by reducing configuration complexity and providing starter packages for rapid development.

Why use Spring Boot?

It addresses Java development challenges such as excessive configuration, low productivity, complex deployment, and difficult third‑party integration.

It follows the "convention over configuration" principle, allowing projects to start quickly and be packaged as an executable JAR with an embedded servlet container.

Core feature 1: Independent execution of Spring projects via java -jar xxx.jar.

Core feature 2: Embedded servlet containers (Tomcat, Jetty, Undertow) eliminate the need for WAR deployment.

Core feature 3: Starters simplify Maven dependencies; for example, spring-boot-starter-web automatically pulls required libraries.

Core feature 4: Auto‑configuration scans the classpath and automatically configures beans, drastically reducing manual setup.

Core configuration files

bootstrap.yml / bootstrap.properties : Loaded by the parent ApplicationContext before application.yml, cannot be overridden.

application.yml / application.properties : Used for Spring Boot's automatic configuration.

What is a Spring Boot Starter?

Starters are dependency bundles that provide a one‑stop integration of Spring and other technologies, eliminating the need to search for individual libraries. At startup, Spring Boot scans JARs for spring.factories, loads auto‑configuration classes, and registers beans based on @Conditional annotations.

Can Spring Boot work with legacy Spring projects?

Yes, by using @ImportResource to import existing Spring XML configuration files.

Spring Boot auto‑configuration principle

The core consists of @EnableAutoConfiguration, @Configuration, and @ConditionalOnClass. Spring reads spring.factories from each starter to determine which beans to create based on classpath presence.

Supported embedded web containers

Tomcat, Jetty, and Undertow.

Difference between application.properties and bootstrap.properties

bootstrap.properties

is loaded earlier during the bootstrap phase and its properties cannot be overridden, while application.properties drives Spring Boot's auto‑configuration.

Spring Boot Actuator

Actuator exposes a set of HTTP endpoints that provide real‑time insight into the running application's health, metrics, and environment.

What is a CSRF attack?

Cross‑Site Request Forgery forces an authenticated user to perform unwanted actions on a web application, targeting state‑changing requests rather than data theft.

Exception handling in Spring Boot

Use @ControllerAdvice to create a global exception handler that processes exceptions thrown by controller methods.

Spring Boot vs. Spring MVC

Spring Boot embeds Tomcat/Jetty/Undertow, enabling standalone execution without separate deployment.

Auto‑configuration reduces XML and JavaConfig boilerplate, simplifying project setup.

Spring MVC is a servlet‑based MVC framework focused on web development, requiring more manual configuration.

What is FreeMarker?

FreeMarker is a Java‑based template engine that separates presentation from business logic, allowing developers to write code while designers handle HTML.

Why use spring-boot-maven-plugin ?

spring-boot:run

– runs the application. spring-boot:repackage – creates an executable JAR or WAR. spring-boot:start / spring-boot:stop – manage the application lifecycle (useful for integration tests). spring-boot:build-info – generates build metadata.

JPA vs. Hibernate

JPA is a specification (set of interfaces and annotations).

Hibernate is a concrete implementation of JPA.

When using JPA, developers import annotations from javax.persistence without referencing Hibernate‑specific packages.

What is the ELK stack and how to use it with Spring Boot?

The ELK stack consists of Elasticsearch, Logstash, and Kibana.

ELK stack diagram
ELK stack diagram

Elasticsearch is a NoSQL search engine based on Lucene. Logstash is a log pipeline that ingests, transforms, and forwards data. Kibana provides a UI for visualizing data stored in Elasticsearch. Together they enable log collection, indexing, and visualization for applications, including Spring Boot.

Static resource mapping priority in Spring Boot

Spring Boot maps static resources under /**. The lookup order is: META-INF/resources > resources > static > public.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

backend-developmentConfigurationSpring Boot
Spring Full-Stack Practical Cases
Written by

Spring Full-Stack Practical Cases

Full-stack Java development with Vue 2/3 front-end suite; hands-on examples and source code analysis for Spring, Spring Boot 2/3, and Spring Cloud.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.