<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/spring-boot-build-url-shortener---part-2-project-setup-m4iho4vxd" -->

---
title: Spring Boot: Build URL Shortener - Part 2: Project Setup
description: A hands-on walkthrough of setting up a Spring Boot project for a URL shortener application using start.spring.io, covering project structure, component...
canonical: https://daily.dev/posts/spring-boot-build-url-shortener---part-2-project-setup-m4iho4vxd
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Spring Boot: Build URL Shortener - Part 2: Project Setup | daily.dev
og:description: A hands-on walkthrough of setting up a Spring Boot project for a URL shortener application using start.spring.io, covering project structure, component...
og:url: https://daily.dev/posts/spring-boot-build-url-shortener---part-2-project-setup-m4iho4vxd
og:image: https://api.daily.dev/og/posts/M4IHo4vXD.png
og:image:alt: Spring Boot: Build URL Shortener - Part 2: Project Setup
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 - Part 2: Project Setup

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

## Summary

A hands-on walkthrough of setting up a Spring Boot project for a URL shortener application using start.spring.io, covering project structure, component scanning rules, and the difference between @Controller and @RestController. The tutorial demonstrates serving static HTML, rendering dynamic data with Thymeleaf templates, building a reusable page layout with the Thymeleaf layout dialect, and including Bootstrap CSS/JS via WebJars instead of CDN links for offline support.

## Full article

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

## Questions this post answers

### What is the difference between @Controller and @RestController in Spring Boot?

@Controller renders a view template like an HTML page, while @RestController marshals the returned value directly as JSON in the response body. @RestController is actually a convenience annotation that combines @Controller and @ResponseBody, so you don't need to add @ResponseBody to every handler method when building a REST API instead of a traditional web app.

_daily.dev surfaces practical Spring Boot explainers for developers deciding between MVC views and REST endpoints._

### How do I include Bootstrap CSS in a Spring Boot Thymeleaf project without using a CDN?

Add the org.webjars bootstrap dependency (for example version 5.3.3) to pom.xml, then reference the packaged CSS and JS files from the classpath path webjars/bootstrap/5.3.3/css/bootstrap.min.css instead of a CDN link. This lets the app keep working offline since the static resources are bundled as a jar dependency rather than fetched externally.

_Developers wiring up offline-friendly asset loading can track these Spring Boot patterns on daily.dev._

### Why isn't my Spring Boot controller being detected even though I created it in my project?

Component scanning only covers the package containing the class annotated with @SpringBootApplication and its sub-packages. If a controller, service, or repository is placed in a sibling package outside that hierarchy, Spring Boot won't scan or register it, which is a common mistake beginners make when organizing their project structure.

_Anyone debugging Spring Boot component scanning issues can find similar walkthroughs on daily.dev._

## 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
- [Writing a Thymeleaf component library](https://daily.dev/posts/writing-a-thymeleaf-component-library-iotnp1w9y) · Wim Deblauwe · 6 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/spring-boot-build-url-shortener---part-2-project-setup-m4iho4vxd)

```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 - Part 2: Project Setup","url":"https://daily.dev/posts/spring-boot-build-url-shortener---part-2-project-setup-m4iho4vxd","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/spring-boot-build-url-shortener---part-2-project-setup-m4iho4vxd"},"datePublished":"2026-09-27T07:26:39.320Z","dateModified":"2026-09-27T07:53:19.585Z","description":"A hands-on walkthrough of setting up a Spring Boot project for a URL shortener application using start.spring.io, covering project structure, component...","image":"https://i.ytimg.com/vi/AvZjSrJzgWM/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/AvZjSrJzgWM/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---part-2-project-setup-m4iho4vxd","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"webdev,java,spring-boot","timeRequired":"PT25M","video":{"@type":"VideoObject","name":"Spring Boot: Build URL Shortener - Part 2: Project Setup","description":"A hands-on walkthrough of setting up a Spring Boot project for a URL shortener application using start.spring.io, covering project structure, component...","thumbnailUrl":"https://i.ytimg.com/vi/AvZjSrJzgWM/sddefault.jpg","uploadDate":"2026-09-27T07:26:39.320Z","duration":"PT25M","url":"https://api.daily.dev/r/M4IHo4vXD","embedUrl":"https://www.youtube.com/embed/AvZjSrJzgWM"}}
{"@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 - Part 2: Project Setup"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/spring-boot-build-url-shortener---part-2-project-setup-m4iho4vxd#faq","mainEntity":[{"@type":"Question","name":"What is the difference between @Controller and @RestController in Spring Boot?","acceptedAnswer":{"@type":"Answer","text":"@Controller renders a view template like an HTML page, while @RestController marshals the returned value directly as JSON in the response body. @RestController is actually a convenience annotation that combines @Controller and @ResponseBody, so you don't need to add @ResponseBody to every handler method when building a REST API instead of a traditional web app. daily.dev surfaces practical Spring Boot explainers for developers deciding between MVC views and REST endpoints."}},{"@type":"Question","name":"How do I include Bootstrap CSS in a Spring Boot Thymeleaf project without using a CDN?","acceptedAnswer":{"@type":"Answer","text":"Add the org.webjars bootstrap dependency (for example version 5.3.3) to pom.xml, then reference the packaged CSS and JS files from the classpath path webjars/bootstrap/5.3.3/css/bootstrap.min.css instead of a CDN link. This lets the app keep working offline since the static resources are bundled as a jar dependency rather than fetched externally. Developers wiring up offline-friendly asset loading can track these Spring Boot patterns on daily.dev."}},{"@type":"Question","name":"Why isn't my Spring Boot controller being detected even though I created it in my project?","acceptedAnswer":{"@type":"Answer","text":"Component scanning only covers the package containing the class annotated with @SpringBootApplication and its sub-packages. If a controller, service, or repository is placed in a sibling package outside that hierarchy, Spring Boot won't scan or register it, which is a common mistake beginners make when organizing their project structure. Anyone debugging Spring Boot component scanning issues can find similar walkthroughs on daily.dev."}}]}
```

