Spring Boot Course · Reference

Glossary

The vocabulary of Spring Boot. Terms here are used consistently across every lesson. Bookmark this; it grows over time.

Spring Framework
The large, foundational Java framework Spring Boot is built on. Its core idea is inversion of control: you describe the objects your app needs and Spring creates and wires them together for you. added L1
Spring Boot
An opinionated layer on top of Spring that removes boilerplate. It gives you sensible defaults, an embedded web server, and auto-configuration so you can run a real app with almost no manual setup. added L1
Dependency Injection (DI)
The pattern where an object receives the things it depends on from the outside (Spring supplies them) instead of creating them itself. Makes code loosely coupled and easy to test. added L1
Bean
Any object that Spring creates, configures, and manages for you inside its application context. Your controllers, services, and repositories all become beans. added L1
Application Context
Spring's container — the registry that holds all the beans and knows how to wire them together. added L1
Auto-configuration
Spring Boot inspects the libraries (starters) on your classpath and automatically configures sensible beans for them. Add the web starter → it configures a web server and JSON handling, no XML required. added L1
Starter
A curated bundle of dependencies for one job, named spring-boot-starter-*. E.g. spring-boot-starter-web pulls in everything needed to build a web/REST app, at compatible versions. added L1
SDKMAN!
A version manager for the JVM ecosystem (Java, and tools like the Spring Boot CLI) on macOS/Linux. Install a JDK with sdk install java 21-tem and switch versions per project with sdk use — no manual PATH/JAVA_HOME editing. added L1
JDK (Java Development Kit)
The toolkit that compiles and runs Java code (compiler + runtime + libraries). Spring Boot needs one installed; we get it via SDKMAN. added L1
Spring Boot CLI
A command-line tool (installable via sdk install springboot) whose spring init command generates a project from the terminal — the CLI front-end to Spring Initializr. added L1
Maven
A build tool for Java that compiles your code, runs tests, manages dependencies, and packages the app — all driven by a pom.xml file. (Gradle is the common alternative.) added L1
Maven Wrapper (mvnw)
A script committed inside the project (mvnw / mvnw.cmd) that downloads and runs the exact Maven version the project needs, so contributors don't have to install Maven themselves. Run goals with it, e.g. ./mvnw spring-boot:run. added L1
Spring Initializr
The official project generator at start.spring.io. You pick your build tool, language, Spring Boot version, and starters; it hands you a ready-to-run project. added L1
@SpringBootApplication
The single annotation on your main class that switches on auto-configuration, component scanning, and configuration. The entry point of every Spring Boot app. added L1
@RestController
Marks a class as a web controller whose method return values are written directly to the HTTP response body (as JSON), rather than treated as view names. added L1
@GetMapping (and friends)
Maps an HTTP request to a method. @GetMapping("/books") handles GET /books; siblings are @PostMapping, @PutMapping, @DeleteMapping. added L1
Embedded server
Spring Boot ships a web server (Tomcat by default) inside your application JAR. You run a plain Java program and it serves HTTP — no separate server to install or deploy to. added L1
JSON
JavaScript Object Notation — a compact, language-neutral text format for structured data. The default body format for REST APIs; what your endpoints return. added L2
Resource
The "noun" a REST API exposes and lets clients act on — e.g. a book at /api/books. Endpoints are organised around resources. added L2
Package-by-feature
Organising code so all classes for one feature live in one package (com.example.library.book holds the book's controller, service, repository, model). The alternative is package-by-layer (separate controller/service/… packages). Either way, keep everything under the main class's package so component scanning finds it. added L2
UUID
A 128-bit globally-unique identifier (e.g. 11111111-1111-1111-1111-111111111111). We use it as the Book id: it can be generated by the app, isn't sequentially guessable, and stays unique across systems. The common alternative is an auto-incremented numeric Long. Jackson serialises a UUID as a JSON string. added L2
Serialization / Deserialization
Serialization turns a Java object into JSON (on the way out); deserialization turns incoming JSON back into a Java object (on the way in). added L2
Jackson
The JSON library bundled by spring-boot-starter-web. It reads an object's accessors to serialise it to JSON, and builds objects from incoming JSON. You rarely call it directly — Spring does. added L2
HTTP message converter
The Spring MVC component that writes a method's return value to the response body (and reads request bodies into objects). The Jackson-backed converter is what produces your JSON and sets Content-Type: application/json. added L2
Content negotiation
How Spring decides which format to send (e.g. JSON) based on the return type and what the client asks for, then picks the matching message converter. added L2
@ResponseBody
Marks a return value as the HTTP response body itself (not a view name to render). It's folded into @RestController, which is why every method there returns data. added L2
@RequestMapping
Maps requests to a controller or method. On a class it sets a base path prepended to every method's mapping; the HTTP-verb shortcuts (@GetMapping, etc.) are specialised forms of it. added L2
Layered architecture
Organising an app as a thin stack of single-purpose layers, each talking only to the one below: controller (HTTP) → service (business logic) → repository (data). Keeps each concern isolated so a change in one layer barely touches the others. added L3
Separation of concerns
The design principle behind the layers: each class does one job. The controller speaks HTTP, the service holds business logic, the repository handles data — none of them does another's work. added L3
Service (@Service)
The business-logic layer, sitting between the controller and the data layer. @Service marks the class as a Spring-managed bean. The controller delegates the real work to it. added L3
Stereotype annotation
An annotation that registers a class as a Spring bean via component scanning. @Component is the base; @Service, @Repository, and @Controller/@RestController are specialised forms that also document the class's architectural role. added L3
Constructor injection
Supplying a class's dependencies through its constructor (Spring passes them in at startup). The recommended DI style: the field can be final, missing dependencies fail fast, the dependencies are explicit, and the class can be instantiated in a plain test without Spring. With a single constructor, no @Autowired is needed. added L3
Inversion of Control (IoC)
The principle that the framework, not your code, is in charge of creating objects and wiring them together. Spring's container constructs your beans and supplies their collaborators; dependency injection is how it does so. added L3
@Autowired
Marks a constructor, field, or setter for Spring to inject a dependency into. Redundant on a class's single constructor (Spring uses it automatically since 4.3) — needed only to pick among multiple constructors or for field/setter injection. added L3
CRUD
Create, Read, Update, Delete — the four basic operations on a resource. In REST they map to HTTP methods: POST (create), GET (read), PUT (update/replace), DELETE (delete). added L4
@RequestBody
Binds a method parameter to the HTTP request body: Spring (via Jackson) deserializes the incoming JSON into that Java object. The inbound counterpart of the JSON serialization you saw in L2. added L4
@PathVariable
Binds a placeholder in the URL template to a method parameter. With @GetMapping("/{id}"), @PathVariable UUID id captures the {id} segment and converts it to the declared type. added L4
ResponseEntity
A wrapper that lets a controller method control the whole HTTP response — status code, headers, and body — instead of just the body. Use it when the status isn't always the default 200 OK (e.g. 201 Created, 204 No Content, 404 Not Found). added L4
HTTP status code
The three-digit code that says how a request went: 2xx success (200 OK, 201 Created, 204 No Content), 4xx client error (400 Bad Request, 404 Not Found, 415 Unsupported Media Type), 5xx server error. Choosing the right one is part of designing a good API. added L4
Location header
A response header carrying the URL of a resource. By convention a 201 Created response sets it to the newly created resource's address; ResponseEntity.created(uri) sets both the status and this header. added L4
Idempotency
A property of an operation: performing it once or many times leaves the server in the same state. GET, PUT, and DELETE are idempotent; POST is not (each call creates another resource). A key reason create is POST and replace is PUT. added L4
JPA (Jakarta Persistence API)
A specification — interfaces and annotations (@Entity, @Id, …) describing how Java objects map to database rows. It defines the contract; it doesn't run any SQL itself. added L5
Hibernate
The most common implementation of JPA, and Spring Boot's default. It does the real work: generating SQL, mapping rows to objects, and tracking entity changes. added L5
ORM (Object-Relational Mapping)
The technique of mapping objects in your code to rows in relational tables (and back), so you work with Java objects instead of hand-written SQL. Hibernate is an ORM. added L5
Spring Data JPA
A Spring layer on top of Hibernate that eliminates repository boilerplate: you declare an interface extending JpaRepository and Spring Data generates the implementation at runtime. added L5
@Entity
Marks a class as a persistent JPA entity — one mapped to a database table, with each instance a row. Entities are mutable classes (not records) with a no-arg constructor, because Hibernate needs to construct and populate them. added L5
@Id
Marks the field that is the entity's primary key — the column that uniquely identifies each row. In this course it's a UUID. added L5
Repository
The data-access layer (the bottom of the controller → service → repository stack). It hides how data is stored and retrieved behind a clean interface so the service doesn't care whether it's an in-memory map or a Postgres database. added L5
JpaRepository
The Spring Data interface you extend to get a ready-made repository. JpaRepository<Book, UUID> supplies save, findById, findAll, deleteById, count, and more, with no implementation written by you. added L5
Derived query method
A repository method whose name is parsed into a query: findByAuthor becomes WHERE author = ?. Keywords like Containing, IgnoreCase, GreaterThanEqual, and OrderBy…Desc compose into the SQL — no method body required. added L5
PostgreSQL (Postgres)
A robust, open-source relational database widely used in production. Unlike an in-memory store it's a separate server process that keeps your data across restarts, and it has a native uuid column type that maps cleanly to the entity's UUID id. added L5
Docker Compose
A tool that defines and runs containers from a YAML file (compose.yaml). Here it declares the Postgres container the app needs. With spring-boot-docker-compose on the classpath, Spring Boot starts that container on boot, reads its credentials, and auto-configures the datasource — no JDBC URL to write by hand. added L5
ddl-auto
The Hibernate setting (spring.jpa.hibernate.ddl-auto) controlling how the schema is managed at startup: create-drop/update (dev convenience), or validate/none (production). We use validate — Hibernate only checks the entities match the schema; Liquibase owns the schema itself. Never let Hibernate rewrite a production schema. added L5
Database migration
A versioned, ordered change to the database schema, applied automatically and tracked so it runs exactly once. Replacing implicit auto-DDL, migrations make schema changes explicit, reviewable, and replayable from an empty database — the production-grade way to evolve a schema. added L5
Liquibase
A database-migration tool. Spring Boot auto-runs it on startup from a master changelog (default path db/changelog/db.changelog-master.yaml), applying any not-yet-run changesets. The common alternative is Flyway. added L5
Changelog / changeset
A changelog is the ordered list of migrations; a changeset is one unit of change (e.g. "create the book table"), identified by id + author. Liquibase records applied changesets in a tracking table and never re-runs them — so an applied changeset is immutable: to change the schema you append a new one. added L5
Lombok
A library that generates boilerplate (getters, constructors, equals/hashCode) from annotations at compile time. Safe on entities: @Getter, @Setter, @NoArgsConstructor, id-only @EqualsAndHashCode. Avoid on entities: @Data, all-fields @EqualsAndHashCode, and unguarded @ToString. added L5
@RequestParam
Binds a query-string value (the part after ?, e.g. ?author=Bloch) to a method parameter. Use it for filtering, sorting, or paging a collection — as opposed to @PathVariable, which identifies a single resource in the path. added L5
UUIDv7
A time-ordered UUID: its leading bits are a millisecond timestamp, so values sort by creation time. This gives the database index locality of an auto-increment key while keeping a UUID's global uniqueness and app-side generation. The older UUID.randomUUID() is v4 (fully random, poor index locality). added L5
Entity relationship
A link between two entities mirroring a foreign key between their tables. The cardinalities are one-to-many / many-to-one (one author, many books), one-to-one, and many-to-many. A bidirectional relationship is navigable from both sides (author → books and book → author). added L6
Foreign key (FK)
A column whose value references a primary key in another table, enforcing that the reference points to a real row. book.author_id is a foreign key into author.id. A foreign key lives in exactly one of the two tables — the "many" side. added L6
@ManyToOne
Maps the many side of a relationship: many Books reference one Author. Paired with @JoinColumn, it owns the foreign-key column. Defaults to eager fetching; prefer fetch = FetchType.LAZY and load the association deliberately. added L6
@OneToMany
Maps the one side: one Author has many Books, held as a collection. On a bidirectional relationship it's the inverse side and uses mappedBy; it owns no column. Defaults to lazy fetching. added L6
Owning vs. inverse side
In a bidirectional relationship, the owning side holds the foreign key (the @ManyToOne side) and is what Hibernate reads to decide what to persist; the inverse side (@OneToMany(mappedBy = …)) is for navigation only. To save the link you must set the owning side — hence a helper that updates both sides at once. added L6
mappedBy
An attribute on the inverse side naming the field on the owning side that maps the relationship (@OneToMany(mappedBy = "author") → the author field on Book). It tells JPA "don't create another column; this link is already mapped over there." added L6
@JoinColumn
Names the foreign-key column on the owning side: @JoinColumn(name = "author_id") maps the author reference to the author_id column. added L6
Cascade / orphanRemoval
Cascade propagates an operation from a parent to its associated entities — CascadeType.ALL means saving or deleting an author also saves or deletes its books. orphanRemoval deletes a child once it's removed from the parent's collection. Powerful but sharp: this course leaves cascade off, so deleting an author can't silently wipe their books and the database's foreign key guards against accidental deletes. Reach for cascade only when you've deliberately decided a child should share its parent's lifecycle. added L6
DTO (Data Transfer Object)
A plain object — here an immutable record — that shapes data crossing the API boundary, separate from your entities. A request DTO (e.g. CreateBookRequest, no id) defines what you accept; a response DTO (e.g. BookResponse) defines what you send. A related entity is exposed as a small projection — a compact, embeddable view such as AuthorSummary (id + name, no nested collections) — which both hides internals and breaks the entity cycle that would otherwise crash JSON serialization. DTOs decouple the wire format from the schema. added L6
Open Session in View (OSIV)
A Spring Boot default (spring.jpa.open-in-view=true) that keeps the persistence session open for the whole request, so lazy associations can load during JSON rendering. Convenient — it's why mapping an entity to a DTO in the controller "just works" — but it can hide N+1 queries; many teams disable it. added L6
N+1 query problem
Loading N parent rows and then firing one extra query per parent to fetch its children — N+1 queries where one join would do. It's the most common JPA performance trap; fixes include a JOIN FETCH query or an entity graph. added L6
Bean Validation (Jakarta Validation)
A Java standard for declaring input rules as field annotations and having them checked automatically. Hibernate Validator is the reference implementation; Spring Boot wires it in via spring-boot-starter-validation. added L7
Constraint annotation
An annotation declaring a validation rule on a field: @NotNull, @NotBlank (non-null and non-whitespace), @Size(min,max), @Positive, @Min/@Max, @Email, @Pattern. Placed on the request DTO — the boundary shape — not the entity. added L7
@Valid
The switch that triggers validation. On a @RequestBody parameter it tells Spring to check the object's constraints before the handler runs; a violation throws MethodArgumentNotValidException. Without it, constraints are ignored. added L7
MethodArgumentNotValidException
The exception Spring throws when a @Valid body fails its constraints. Its BindingResult holds the per-field errors; a handler reads them to build a response. Maps naturally to 400 Bad Request. added L7
@ControllerAdvice / @RestControllerAdvice
A class whose @ExceptionHandler methods apply across every controller — one central place to turn exceptions into HTTP responses. The @RestController variant writes return values to the response body (as JSON), like @RestController does. added L7
@ExceptionHandler
Marks a method that handles a given exception type. In a @RestControllerAdvice it catches that exception from any controller and returns the error response to send. Spring picks the most specific handler, so a method for a precise type out-ranks a catch-all @ExceptionHandler(Exception.class). added L7
ResponseEntityExceptionHandler
Spring's base class for a global exception handler. Extending it inherits ready-made, ProblemDetail-shaped handling for every standard Spring MVC exception (malformed JSON, type mismatch, unsupported method/media type, validation, …). You override individual methods (e.g. handleMethodArgumentNotValid) to customize, add @ExceptionHandlers for your own exceptions, and rely on specificity so a catch-all only fires for the truly unexpected. added L7
Problem Detail (RFC 9457)
The standard JSON format for HTTP error bodies — fields type, title, status, detail, instance, plus custom members. Spring's ProblemDetail class produces it; returning one sets the application/problem+json content type and the status. A single consistent error shape across the whole API. added L7
Pagination
Returning a large collection one fixed-size page at a time instead of all at once, by pushing a LIMIT and OFFSET down to the database. Bounds the work done by the database, server, and client regardless of table size. Pages are zero-based (page 0 is the first). added L8
Pageable
Spring Data's request for a page: which page number, how many rows, and the sort order. Declared as a controller method parameter, it is built automatically from the page, size, and sort query parameters — no @RequestParam needed — and handed to a repository method. added L8
Page / Slice
What a paged repository method returns. Page<T> holds the slice of rows plus metadata (totalElements, totalPages, current number, size) — it runs an extra COUNT query to know the totals. Slice<T> skips the count and only knows whether a next page exists (cheaper; good for "load more"). Page.map(...) transforms each element to a DTO while preserving the metadata. added L8
@PageableDefault
Sets the default page size and sort applied when a request omits them, e.g. @PageableDefault(size = 20, sort = "title"). Without it, an unparameterized request falls back to Spring's global default (20 rows, unsorted). added L8
PagedModel / @EnableSpringDataWebSupport
Serializing a raw Page (PageImpl) is discouraged — it's an internal type with no guarantee its JSON stays stable across versions (Spring logs a warning). PagedModel is the stable representation: rows under content, paging facts under one page object. Turn it on globally with @EnableSpringDataWebSupport(pageSerializationMode = VIA_DTO) and controllers can keep returning Page. The page size is also capped by spring.data.web.pageable.max-page-size (default 2000) so a client can't request unbounded rows. added L8
Lazy vs. eager fetching
Whether an association loads with its owner (eager) or only when first accessed (lazy, via a proxy that fires a query on touch). @ManyToOne defaults to eager but should be set LAZY; @OneToMany is lazy by default. Lazy is the right default — but every lazy touch is a potential query, which is how the N+1 problem arises. added L9
@EntityGraph
A fetch hint on a Spring Data repository method naming the associations to load in the same query: @EntityGraph(attributePaths = "author"). The go-to fix for N+1 — the association is LEFT JOINed in rather than lazily loaded per row. Safe with pagination for to-one associations (a join adds columns, not rows); for to-many collections the query is more involved (modern Hibernate paginates the parents in a subquery first). added L9
Fetch join (JOIN FETCH)
An explicit JPQL clause that loads an association alongside its owner in one query: select b from Book b join fetch b.author. The hand-written equivalent of @EntityGraph — reach for it inside a custom @Query. added L9
LazyInitializationException
Thrown when code touches a lazy association after its persistence session has closed (Could not initialize proxy … no session). Common once spring.jpa.open-in-view=false: it turns a hidden lazy load into a loud failure, signalling exactly where you must fetch the association deliberately (a fetch join or @EntityGraph). added L9
@BatchSize / batch fetching
An alternative to join-fetching: keep associations lazy but load them in batches. hibernate.default_batch_fetch_size = N (or @BatchSize(size = N)) collapses N per-row lazy loads into a few WHERE id IN (?, ?, …) queries — turning 1 + N into roughly 1 + (N / N). Needs an open session when the collection is accessed. added L9
Unit test
A test of one class in isolation, with its collaborators replaced by test doubles — no framework, no database, no network. Fast (milliseconds) and precise: a failure points straight at the class under test. The broad base of the test pyramid. added L10
Test pyramid
A guideline for the mix of tests: many fast unit tests at the base, fewer slice tests in the middle (one layer with a little framework), and a few slow end-to-end tests at the top. Push coverage down toward the fast base where you can. added L10
Test double (mock / stub)
A stand-in for a real dependency in a test. A stub is scripted to return canned answers (when(repo.findById(id)).thenReturn(...)); a mock also records interactions so you can assert they happened (verify(repo).save(...)). In Mockito a single @Mock object does both jobs. added L10
JUnit 5
The standard Java test framework: @Test methods, lifecycle hooks (@BeforeEach), @DisplayName, and an extension model (@ExtendWith) that plugs in tools like Mockito. Ships with Spring Boot's test starter. added L10
Mockito
The de-facto Java mocking library. @Mock creates a test double; when(...).thenReturn(...) stubs its answers; verify(...) asserts it was (or, with never(), wasn't) called; an ArgumentCaptor grabs the exact argument passed to a mock so you can assert on it. Enabled in JUnit 5 via @ExtendWith(MockitoExtension.class), which runs in strict-stubbing mode. added L10
AssertJ
A fluent assertion library: assertThat(x).isEqualTo(y), isSameAs, assertThatThrownBy(() -> …).isInstanceOf(...).hasMessageContaining(...). Reads left-to-right and gives rich failure messages. The assertion style used throughout this course. added L10
Arrange–Act–Assert (AAA)
The three-beat shape of a good test: Arrange the data and stub the doubles, Act by calling the one method under test, Assert the outcome. One action, one behaviour, per test. added L10

← Course home