Backend
Spring Boot
An opinionated layer over Spring for Java and Kotlin with auto-configuration and one-command startup.
What it is
Spring Boot removed the tedious XML setup of classic Spring. Auto-configuration picks beans from classpath dependencies, and starters pull in consistent library sets.
An app is packaged as one executable JAR with an embedded Tomcat. Actuator gives metrics and health checks, Spring Data covers databases, Spring Security covers auth.
It is the de facto standard for enterprise Java backends. It supports Kotlin, Java 21 virtual threads and GraalVM native images.
Use it when
- Enterprise backends, banking and complex domain systems.
- Microservices on the JVM with a ready ecosystem.
- The team knows Java or Kotlin.
Avoid it when
- Small scripts and prototypes: the startup is too heavy.
- Tight memory and cold-start limits without native images.
Key concepts
- Auto-configuration
- Automatic bean creation based on the classpath and properties.
- Starter
- A dependency that pulls in a ready set of libraries.
- IoC / DI
- The container creates beans and injects them into other beans.
- Actuator
- Monitoring endpoints: health, metrics, info.
Example
Cheat sheet
| Command or code | What it does |
|---|---|
@SpringBootApplication | Application entry point |
@RestController | Controller that returns JSON |
@GetMapping("/users/{id}") | GET handler |
@PostMapping @RequestBody UserDto dto | POST handler with a body |
@PathVariable Long id | Path parameter |
@Service | Business logic bean |
interface UserRepo extends JpaRepository<User, Long> | Repository without an implementation |
@Valid | Turns on DTO validation |
./mvnw spring-boot:run | Runs the application |
./mvnw test | Runs the tests |
server.port=8081 | Port in application.properties |
How to learn it
- First learn Java: collections, the Stream API and exceptions.
- Generate a project on start.spring.io with Web and Data JPA.
- Understand dependency injection and the Spring bean container.
- Write a REST controller with Mapping annotations.
- Connect PostgreSQL through Spring Data JPA and write a repository.
- Add validation, error handling and configuration through application.yml.
- Set up security with Spring Security.
- Write tests (JUnit, MockMvc) and build a Docker image.
Interview questions
1. What is auto-configuration?
Spring Boot inspects the classpath and properties and creates needed beans automatically. For example, on seeing a DB driver it configures a DataSource.
2. What are a bean and IoC?
A bean is an object managed by the Spring container. IoC means the container creates dependencies and passes them in, instead of the class calling
new.3. What is Actuator for?
Production monitoring: health endpoints, metrics, build info. It integrates with Prometheus and Kubernetes probes.
Related technologies
- JavaA statically typed JVM language: the base of enterprise backends, Android and large systems.
- KotlinA modern concise language for the JVM, Android and multiplatform development, fully interoperable with Java.
- PostgreSQLA powerful open source relational database with extensions, JSONB, full-text search and strong SQL support.
- KeycloakAn open source identity and access management solution with SSO, OIDC, SAML and roles.
- Apache KafkaKafka is a distributed event log for high-throughput data streaming with durable storage.
Logos belong to their owners and are used for identification only. Icons: Simple Icons (CC0), Devicon (MIT).