<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/spring-boot-build-url-shortener-application---complete-course-5-hours--4ixlne9yv" -->

---
title: Spring Boot: Build URL Shortener Application - Complete...
description: A five-hour hands-on course builds a URL shortener application from scratch using Spring Boot, covering project setup, MVC controllers vs REST controllers,...
canonical: https://daily.dev/posts/spring-boot-build-url-shortener-application---complete-course-5-hours--4ixlne9yv
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Spring Boot: Build URL Shortener Application - Complete Course (5 Hours) | daily.dev
og:description: A five-hour hands-on course builds a URL shortener application from scratch using Spring Boot, covering project setup, MVC controllers vs REST controllers,...
og:url: https://daily.dev/posts/spring-boot-build-url-shortener-application---complete-course-5-hours--4ixlne9yv
og:image: https://api.daily.dev/og/posts/4IxlNe9Yv.png
og:image:alt: Spring Boot: Build URL Shortener Application - Complete Course (5 Hours)
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Spring Boot: Build URL Shortener Application - Complete Course (5 Hours)

**[SivaLabs \(YouTube\)](https://daily.dev/sources/sivalabs-youtube)** · 300 min read · 0 upvotes · 0 comments

## Summary

A five-hour hands-on course builds a URL shortener application from scratch using Spring Boot, covering project setup, MVC controllers vs REST controllers, Thymeleaf templating with layout dialects, static resources via WebJars, and database integration. It walks through Spring Data JPA fundamentals, comparing JDBC, plain JPA, and Spring Data JPA, then explores three ways to initialize a database (JPA ddl-auto, SQL scripts, and Flyway migrations), landing on Flyway as the production-appropriate choice. It also touches IntelliJ IDEA Ultimate tooling for generating entities from a database schema and Docker Compose for spinning up PostgreSQL, with later sections planned for Spring Security, pagination, and role-based access control.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=XEgS8yq-zgw>

## Questions this post answers

### What is the difference between Spring Boot's @Controller and @RestController annotations?

@Controller is used for traditional web applications that render HTML views, while @RestController returns data (typically JSON) directly in the response body. @RestController is actually a composed annotation that combines @Controller and @ResponseBody, saving you from adding both separately when building a REST API instead of a server-rendered web app.

_Building both server-rendered and REST endpoints in Spring Boot is easier when daily.dev surfaces practical framework walkthroughs._

### How do I use Flyway to manage database schema migrations in a Spring Boot application with PostgreSQL?

Add the flyway-core and flyway-database-postgresql dependencies, then place versioned SQL scripts under src/main/resources/db/migration following the naming pattern V1__description.sql, V2__description.sql. Spring Boot auto-configures Flyway to create a flyway_schema_history table, track which scripts already ran, and apply only new ones on startup, so previously applied migrations must never be edited afterward.

_Developers wiring up Flyway migrations for Postgres often keep track of setup tips like these on daily.dev._

### Why does Spring Boot use an H2 in-memory database automatically when I add spring-boot-starter-data-jpa without configuring a data source?

Spring Boot auto-configures a data source using default in-memory database settings whenever it detects a relational database dependency but no explicit datasource properties. Adding only the H2 dependency causes it to create and destroy an H2 instance on every application start and stop; removing all embedded database drivers without configuring a real data source causes startup to fail entirely.

_Understanding Spring Boot's data source defaults helps when choosing a database setup, a decision daily.dev readers track closely._

## Similar posts on daily.dev

- [Spring Boot tutorial: Get started with Spring Boot](https://daily.dev/posts/spring-boot-tutorial-get-started-with-spring-boot-itnz41zwx) · InfoWorld · 1 upvotes · 0 comments
- [SivaLabs](https://daily.dev/posts/sivalabs-xjczznvwh) · SivaLabs · 0 upvotes · 0 comments

---

Tags: [#java](https://daily.dev/tags/java), [#spring](https://daily.dev/tags/spring), [#spring-boot](https://daily.dev/tags/spring-boot)

[View this post on daily.dev](https://daily.dev/posts/spring-boot-build-url-shortener-application---complete-course-5-hours--4ixlne9yv)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Spring Boot: Build URL Shortener Application - Complete Course (5 Hours)","url":"https://daily.dev/posts/spring-boot-build-url-shortener-application---complete-course-5-hours--4ixlne9yv","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/spring-boot-build-url-shortener-application---complete-course-5-hours--4ixlne9yv"},"datePublished":"2026-09-27T07:26:44.324Z","dateModified":"2026-09-27T07:34:44.409Z","description":"A five-hour hands-on course builds a URL shortener application from scratch using Spring Boot, covering project setup, MVC controllers vs REST controllers,...","image":"https://i.ytimg.com/vi/XEgS8yq-zgw/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/XEgS8yq-zgw/sddefault.jpg","isAccessibleForFree":true,"articleSection":"SivaLabs (YouTube)","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"SivaLabs (YouTube)","logo":"https://media.daily.dev/image/upload/s--8ATVo4an--/f_auto,q_auto/v1790493987/logos/sivalabs-youtube?_a=BAMAMicg0","url":"https://daily.dev/sources/sivalabs-youtube"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/spring-boot-build-url-shortener-application---complete-course-5-hours--4ixlne9yv","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java,spring,spring-boot","timeRequired":"PT300M","video":{"@type":"VideoObject","name":"Spring Boot: Build URL Shortener Application - Complete Course (5 Hours)","description":"A five-hour hands-on course builds a URL shortener application from scratch using Spring Boot, covering project setup, MVC controllers vs REST controllers,...","thumbnailUrl":"https://i.ytimg.com/vi/XEgS8yq-zgw/sddefault.jpg","uploadDate":"2026-09-27T07:26:44.324Z","duration":"PT300M","url":"https://api.daily.dev/r/4IxlNe9Yv","embedUrl":"https://www.youtube.com/embed/XEgS8yq-zgw"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"SivaLabs (YouTube)","item":"https://daily.dev/sources/sivalabs-youtube"},{"@type":"ListItem","position":3,"name":"Spring Boot: Build URL Shortener Application - Complete Course (5 Hours)"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/spring-boot-build-url-shortener-application---complete-course-5-hours--4ixlne9yv#faq","mainEntity":[{"@type":"Question","name":"What is the difference between Spring Boot's @Controller and @RestController annotations?","acceptedAnswer":{"@type":"Answer","text":"@Controller is used for traditional web applications that render HTML views, while @RestController returns data (typically JSON) directly in the response body. @RestController is actually a composed annotation that combines @Controller and @ResponseBody, saving you from adding both separately when building a REST API instead of a server-rendered web app. Building both server-rendered and REST endpoints in Spring Boot is easier when daily.dev surfaces practical framework walkthroughs."}},{"@type":"Question","name":"How do I use Flyway to manage database schema migrations in a Spring Boot application with PostgreSQL?","acceptedAnswer":{"@type":"Answer","text":"Add the flyway-core and flyway-database-postgresql dependencies, then place versioned SQL scripts under src/main/resources/db/migration following the naming pattern V1__description.sql, V2__description.sql. Spring Boot auto-configures Flyway to create a flyway_schema_history table, track which scripts already ran, and apply only new ones on startup, so previously applied migrations must never be edited afterward. Developers wiring up Flyway migrations for Postgres often keep track of setup tips like these on daily.dev."}},{"@type":"Question","name":"Why does Spring Boot use an H2 in-memory database automatically when I add spring-boot-starter-data-jpa without configuring a data source?","acceptedAnswer":{"@type":"Answer","text":"Spring Boot auto-configures a data source using default in-memory database settings whenever it detects a relational database dependency but no explicit datasource properties. Adding only the H2 dependency causes it to create and destroy an H2 instance on every application start and stop; removing all embedded database drivers without configuring a real data source causes startup to fail entirely. Understanding Spring Boot's data source defaults helps when choosing a database setup, a decision daily.dev readers track closely."}}]}
```

