From Design Frames to Thymeleaf Pages: Briefing an AI Agent for a Spring Boot Blog
Four SVG design frames go into the project, you add spring-boot-starter-thymeleaf yourself, and the agent builds one HomeController, four templates and shared header, footer and post-card fragments. Then a leftover static/index.html still shows 'Hi' until you delete it.
What you will learn
- Add the Thymeleaf starter yourself before briefing the agent
- Give an agent design frames and one clear brief for sample pages
- Read what it built: one controller, four templates and shared fragments
- Fix the leftover static index.html that hides the new home page
Before you start
- Your First Spring Boot 4 Project
- Plan Before Code
The blog has a design: four page frames (home, post, about and author) as SVG files with numbered notes. This step turns them into real pages. You put the frames in the project, add Thymeleaf yourself, hand one clear brief to the AI agent inside IntelliJ, and then run the blog and click through every page.
The design goes into the project
The Sample design folder holds the four frames and a README that says which URL each page lives on:
# StudyEasy Blog - the design
Four page frames, 1280 px wide desktop. Each file is the frame plus numbered design notes (purple pins on the
frame, yellow notes on the right). Colours, fonts and spacing are the ones in `static/css/blog.css`: build the
pages with its classes, do not add new CSS unless a frame needs something the stylesheet does not have.
| Frame | URL | File |
|---|---|---|
| Home | `/` | home.svg |
| Post | `/posts/{id}` | post.svg |
| About | `/about` | about.svg |
| Author | `/authors/{id}` | author.svg |
Text in grey bars is placeholder copy: the real text comes from the database or the settings.
Each frame shows the page on the left and numbered notes on the right that say how each part should behave: the header, the hero, the latest posts, the byline, the author box. The project itself is still the plain starter: one static/index.html that says "Hi", no controller, no template.
Step 1: pick the template engine yourself
Thymeleaf is the usual server-side template engine for Spring Boot. If you leave the choice to the agent, it might pick something else, so decide it up front. In pom.xml, IntelliJ shows an Add Starters link next to the dependencies tag. It opens the start.spring.io list; under Template Engines tick Thymeleaf, and spring-boot-starter-thymeleaf joins the pom.
Step 2: brief the agent
Open the agent chat (the demo uses Junie, IntelliJ's built-in agent), pick a strong model for a task that touches several files, and medium reasoning effort, since these are only sample pages. The brief says four things: we're building a blog, the designs are in the Sample design folder, create one home controller and generate those pages with sample text only and no logic, and use Thymeleaf because the dependency is already in the pom. A couple of typos don't matter. The agent makes a plan first, then writes the files and runs the tests.
Step 3: read what it built
package org.studyeasy.studyeasyblog.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class HomeController {
@GetMapping("/")
public String home() {
return "home";
}
@GetMapping("/posts/{id}")
public String post() {
return "post";
}
@GetMapping("/about")
public String about() {
return "about";
}
@GetMapping("/authors/{id}")
public String author() {
return "author";
}
}
Each @GetMapping returns a view name, and the names match the four files in templates/. The shared parts live in one fragments file:
<body>
<header class="site-header" th:fragment="header">
<div class="header-inner">
<a class="brand" th:href="@{/}" aria-label="StudyEasy Blog home">
<span class="brand-mark" aria-hidden="true">
<svg viewBox="0 0 24 24" focusable="false">
<path d="M6 17.5 14.5 9l2.5 2.5-8.5 8.5H6z" fill="#CCFBF1"></path>
<path d="m15.7 7.8 1.2-1.2a1.1 1.1 0 0 1 1.6 0l.9.9a1.1 1.1 0 0 1 0 1.6l-1.2 1.2z" fill="#F59E0B"></path>
</svg>
</span>
<span>StudyEasy Blog</span>
</a>
<nav class="site-nav" aria-label="Main navigation">
<a th:href="@{/}">Home</a>
<a th:href="@{/about}">About</a>
</nav>
</div>
</header>
<footer class="site-footer" th:fragment="footer">
<div class="footer-inner">
<a class="footer-brand" th:href="@{/}">StudyEasy Blog</a>
<p>Write it, share it, learn from it.</p>
</div>
</footer>
…plus a postCard(title, category, date, excerpt, url) fragment for the cards. Every page pulls them in with th:replace:
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/layout :: head('A Sample Post')}"></head>
<body>
<header th:replace="~{fragments/layout :: header}"></header>
<main class="page-container article-container">
<a class="text-link back-link" th:href="@{/}"><span aria-hidden="true">←</span> All posts</a>
...
<footer th:replace="~{fragments/layout :: footer}"></footer>
So the layout lives in one place. The styling is in static/css/blog.css, with colour variables taken from the design. The agent also wrote tests for all four routes.
Step 4: run it, and the old page wins
Run the app. The console says Tomcat started on port 8080, but localhost:8080 still shows the old "Hi". The leftover static/index.html from the starter is still there and gets in the way of the new home page. Delete it, run again, and refresh: now the home page from the design comes up.
Step 5: click every page
Open About at /about, then a post at /posts/2 with its byline, body and links back to home and to the author page. The agent says its tests passed; you're the one who checks what a reader will actually see.
All the text is still sample copy. Next, a Post becomes a table so the cards can come from a database.
StudyEasy AI Community
Learn AI engineering, share what you build, and connect with other learners.
Free resources: lesson files, notebooks and code
Ask questions and join engineering discussions
Meet real people learning and building with AI
Related course on Udemy
FULL STACK JAVA : JAVA + JSP + SPRING BOOT AI + REACT + VIBE
Java 25, JSP, Hibernate, Spring Boot 4, REST APIs, React and Spring AI.View on Udemy ↗: FULL STACK JAVA : JAVA + JSP + SPRING BOOT AI + REACT + VIBE (paid course, opens in a new tab)Related posts
Why Spring in 2026: What the Container Does and What Spring Framework 7 Changed
Spring in one line: a container that creates your classes and hands each one what it needs. Plus the Spring Framework 7 baseline (JDK 17 to 25, Jakarta EE 11, Tomcat 11, JUnit 6), what got better than Spring 6, and a two-line version check.
A Plain Spring Project, No Boot: Your First Bean With spring-context
One dependency, one recipe, one getBean: a Maven project with spring-context 7.0.9, a Blog record, an AppConfig with @Bean, and a main that asks the container for the Blog. Then delete @Bean and meet NoSuchBeanDefinitionException.
Inversion of Control and Dependency Injection in Spring: One Program, Built Three Ways
A PostService needs a PostRepository. Build it three ways: the service calls new itself (tight coupling), main hands it in through the constructor (DI by hand), and the Spring container does the wiring from a @Configuration recipe.
Spring Component Scanning: @Component and @ComponentScan Instead of @Bean Methods
Instead of one @Bean method per class, put @Component on EmailNotifier and PostService and @ComponentScan on an empty BlogConfig. Spring walks the package, finds the stickers and builds the beans; main doesn't change.
