{"id":25,"date":"2026-10-08T16:14:55","date_gmt":"2026-10-08T16:14:55","guid":{"rendered":"https:\/\/boot-code.com\/?p=25"},"modified":"2026-10-08T16:14:57","modified_gmt":"2026-10-08T16:14:57","slug":"spring-boot-todo-web-application-with-mysql","status":"publish","type":"post","link":"https:\/\/boot-code.com\/?p=25","title":{"rendered":"Spring Boot Todo Web Application with MySQL"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Absolutely. Since you\u2019ve already been setting up <strong>Java + Maven + MySQL + Eclipse on Ubuntu<\/strong>, here is a complete beginner-friendly tutorial to build a <strong>Spring Boot Todo Web Application with MySQL<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We\u2019ll use:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Java 17+<\/li>\n\n\n\n<li>Maven<\/li>\n\n\n\n<li>Spring Boot<\/li>\n\n\n\n<li>Spring Web<\/li>\n\n\n\n<li>Spring Data JPA<\/li>\n\n\n\n<li>MySQL<\/li>\n\n\n\n<li>Thymeleaf<\/li>\n\n\n\n<li>Eclipse\/STS<\/li>\n\n\n\n<li>HTML\/CSS<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">1. Project architecture<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We will build:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Todo Web Application\n       |\n       v\n   Controller\n       |\n       v\n    Service\n       |\n       v\n  Repository\n       |\n       v\n     MySQL<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The browser will provide a simple UI:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>+----------------------------------+\n|          TODO APPLICATION        |\n+----------------------------------+\n| Add Todo: &#91; Learn Spring ] &#91;Add]|\n+----------------------------------+\n| ID | Todo             | Action   |\n| 1  | Learn Java       | Delete   |\n| 2  | Learn Spring     | Delete   |\n+----------------------------------+<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">2. Create Spring Starter Project<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Open <strong>Spring Initializr<\/strong>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/start.spring.io\/?utm_source=chatgpt.com\">Spring Initializr<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Select:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Project: Maven\nLanguage: Java\nSpring Boot: latest stable version\nGroup: com.example\nArtifact: todo\nName: todo\nPackaging: Jar\nJava: 17 or newer<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add these dependencies:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Spring Web\nSpring Data JPA\nMySQL Driver\nThymeleaf\nSpring Boot DevTools<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then click <strong>Generate<\/strong> and download the ZIP.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Extract it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/Downloads\nunzip todo.zip\ncd todo<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Open it in Eclipse:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>File\n \u2192 Import\n \u2192 Maven\n \u2192 Existing Maven Projects\n \u2192 Select todo folder\n \u2192 Finish<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">3. Create MySQL database<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Start MySQL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start mysql<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Open MySQL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create the database:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE DATABASE todo_db;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create a user:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE USER 'todo_user'@'localhost'\nIDENTIFIED BY 'todo_password';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Give permissions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GRANT ALL PRIVILEGES ON todo_db.* \nTO 'todo_user'@'localhost';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Apply:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FLUSH PRIVILEGES;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SHOW DATABASES;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Exit:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>exit;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">4. Configure Spring Boot<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Open:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>src\/main\/resources\/application.properties<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>spring.application.name=todo\n\nspring.datasource.url=jdbc:mysql:\/\/localhost:3306\/todo_db\nspring.datasource.username=todo_user\nspring.datasource.password=todo_password\n\nspring.jpa.hibernate.ddl-auto=update\nspring.jpa.show-sql=true\n\nspring.jpa.properties.hibernate.format_sql=true\n\nspring.thymeleaf.cache=false\n\nserver.port=8080<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Important<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This setting:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>spring.jpa.hibernate.ddl-auto=update<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">allows Hibernate\/JPA to automatically create\/update tables based on our Java entity.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, our Java class:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@Entity\npublic class Todo {\n    ...\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">will result in a table similar to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>todo\n----------------\nid\ntitle\ncompleted<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">5. Create Todo Entity<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Create:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>src\/main\/java\/com\/example\/todo\/model\/Todo.java<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package com.example.todo.model;\n\nimport jakarta.persistence.Entity;\nimport jakarta.persistence.GeneratedValue;\nimport jakarta.persistence.GenerationType;\nimport jakarta.persistence.Id;\n\n@Entity\npublic class Todo {\n\n    @Id\n    @GeneratedValue(strategy = GenerationType.IDENTITY)\n    private Long id;\n\n    private String title;\n\n    private boolean completed;\n\n    public Todo() {\n    }\n\n    public Todo(String title) {\n        this.title = title;\n        this.completed = false;\n    }\n\n    public Long getId() {\n        return id;\n    }\n\n    public void setId(Long id) {\n        this.id = id;\n    }\n\n    public String getTitle() {\n        return title;\n    }\n\n    public void setTitle(String title) {\n        this.title = title;\n    }\n\n    public boolean isCompleted() {\n        return completed;\n    }\n\n    public void setCompleted(boolean completed) {\n        this.completed = completed;\n    }\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">6. Create Repository<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Create:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>src\/main\/java\/com\/example\/todo\/repository\/TodoRepository.java<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>package com.example.todo.repository;\n\nimport org.springframework.data.jpa.repository.JpaRepository;\n\nimport com.example.todo.model.Todo;\n\npublic interface TodoRepository extends JpaRepository&lt;Todo, Long&gt; {\n\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Spring Data JPA automatically provides methods such as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>findAll()\nfindById()\nsave()\ndeleteById()\ncount()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">So we don&#8217;t need to manually write SQL for basic CRUD operations.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">7. Create Service<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Create:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>src\/main\/java\/com\/example\/todo\/service\/TodoService.java<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>package com.example.todo.service;\n\nimport java.util.List;\n\nimport org.springframework.stereotype.Service;\n\nimport com.example.todo.model.Todo;\nimport com.example.todo.repository.TodoRepository;\n\n@Service\npublic class TodoService {\n\n    private final TodoRepository todoRepository;\n\n    public TodoService(TodoRepository todoRepository) {\n        this.todoRepository = todoRepository;\n    }\n\n    public List&lt;Todo&gt; getAllTodos() {\n        return todoRepository.findAll();\n    }\n\n    public void addTodo(String title) {\n        Todo todo = new Todo(title);\n        todoRepository.save(todo);\n    }\n\n    public void deleteTodo(Long id) {\n        todoRepository.deleteById(id);\n    }\n\n    public void toggleTodo(Long id) {\n\n        Todo todo = todoRepository.findById(id)\n                .orElseThrow();\n\n        todo.setCompleted(!todo.isCompleted());\n\n        todoRepository.save(todo);\n    }\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">8. Create Web Controller<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Create:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>src\/main\/java\/com\/example\/todo\/controller\/TodoController.java<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>package com.example.todo.controller;\n\nimport org.springframework.stereotype.Controller;\nimport org.springframework.ui.Model;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.PostMapping;\nimport org.springframework.web.bind.annotation.RequestParam;\n\nimport com.example.todo.service.TodoService;\n\n@Controller\npublic class TodoController {\n\n    private final TodoService todoService;\n\n    public TodoController(TodoService todoService) {\n        this.todoService = todoService;\n    }\n\n    @GetMapping(\"\/\")\n    public String home(Model model) {\n\n        model.addAttribute(\n                \"todos\",\n                todoService.getAllTodos()\n        );\n\n        return \"index\";\n    }\n\n    @PostMapping(\"\/add\")\n    public String addTodo(\n            @RequestParam String title) {\n\n        todoService.addTodo(title);\n\n        return \"redirect:\/\";\n    }\n\n    @GetMapping(\"\/delete\")\n    public String deleteTodo(\n            @RequestParam Long id) {\n\n        todoService.deleteTodo(id);\n\n        return \"redirect:\/\";\n    }\n\n    @GetMapping(\"\/toggle\")\n    public String toggleTodo(\n            @RequestParam Long id) {\n\n        todoService.toggleTodo(id);\n\n        return \"redirect:\/\";\n    }\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">9. Understand the Controller<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">When the browser visits:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;localhost:8080\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Spring calls:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@GetMapping(\"\/\")\npublic String home(Model model)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It gets the todos:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>todoService.getAllTodos()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">and sends them to Thymeleaf:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>model.addAttribute(\"todos\", ...);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Finally:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>return \"index\";<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">means:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>templates\/index.html<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">will be displayed.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">10. Create HTML page<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Create:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>src\/main\/resources\/templates\/index.html<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Put:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html xmlns:th=\"http:\/\/www.thymeleaf.org\"&gt;\n\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n\n    &lt;title&gt;Todo Application&lt;\/title&gt;\n\n    &lt;style&gt;\n\n        body {\n            font-family: Arial, sans-serif;\n            background: #f4f4f4;\n            margin: 40px;\n        }\n\n        .container {\n            max-width: 700px;\n            margin: auto;\n            background: white;\n            padding: 30px;\n            border-radius: 10px;\n        }\n\n        h1 {\n            text-align: center;\n        }\n\n        form {\n            display: flex;\n            gap: 10px;\n            margin-bottom: 25px;\n        }\n\n        input {\n            flex: 1;\n            padding: 10px;\n        }\n\n        button {\n            padding: 10px 15px;\n            cursor: pointer;\n        }\n\n        table {\n            width: 100%;\n            border-collapse: collapse;\n        }\n\n        th, td {\n            padding: 12px;\n            border-bottom: 1px solid #ddd;\n        }\n\n        .completed {\n            text-decoration: line-through;\n        }\n\n        a {\n            margin-right: 10px;\n        }\n\n    &lt;\/style&gt;\n&lt;\/head&gt;\n\n&lt;body&gt;\n\n&lt;div class=\"container\"&gt;\n\n    &lt;h1&gt;Todo Application&lt;\/h1&gt;\n\n    &lt;form action=\"\/add\" method=\"post\"&gt;\n\n        &lt;input\n            type=\"text\"\n            name=\"title\"\n            placeholder=\"Enter todo\"\n            required&gt;\n\n        &lt;button type=\"submit\"&gt;\n            Add\n        &lt;\/button&gt;\n\n    &lt;\/form&gt;\n\n    &lt;table&gt;\n\n        &lt;thead&gt;\n\n        &lt;tr&gt;\n            &lt;th&gt;ID&lt;\/th&gt;\n            &lt;th&gt;Todo&lt;\/th&gt;\n            &lt;th&gt;Action&lt;\/th&gt;\n        &lt;\/tr&gt;\n\n        &lt;\/thead&gt;\n\n        &lt;tbody&gt;\n\n        &lt;tr th:each=\"todo : ${todos}\"&gt;\n\n            &lt;td th:text=\"${todo.id}\"&gt;\n                1\n            &lt;\/td&gt;\n\n            &lt;td&gt;\n\n                &lt;span\n                    th:text=\"${todo.title}\"\n                    th:classappend=\"${todo.completed} ? 'completed' : ''\"&gt;\n                    Learn Spring\n                &lt;\/span&gt;\n\n            &lt;\/td&gt;\n\n            &lt;td&gt;\n\n                &lt;a\n                    th:href=\"@{\/toggle(id=${todo.id})}\"&gt;\n                    Toggle\n                &lt;\/a&gt;\n\n                &lt;a\n                    th:href=\"@{\/delete(id=${todo.id})}\"&gt;\n                    Delete\n                &lt;\/a&gt;\n\n            &lt;\/td&gt;\n\n        &lt;\/tr&gt;\n\n        &lt;\/tbody&gt;\n\n    &lt;\/table&gt;\n\n&lt;\/div&gt;\n\n&lt;\/body&gt;\n\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">11. Run the application<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">In Eclipse:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Right click TodoApplication.java\n        \u2193\nRun As\n        \u2193\nSpring Boot App<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Or from terminal:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/mvnw spring-boot:run<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You should see something similar to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Tomcat started on port 8080\nStarted TodoApplication<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Open:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;localhost:8080<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">12. Test the application<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Enter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Learn Java<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Click:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Add<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Learn Spring Boot<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Click:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Add<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Your page should show:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>+--------------------------------------+\n|          Todo Application            |\n+--------------------------------------+\n| &#91; Learn Spring Boot       ] &#91; Add ] |\n+--------------------------------------+\n| ID | Todo              | Action      |\n| 1  | Learn Java        | Toggle Delete|\n| 2  | Learn Spring Boot | Toggle Delete|\n+--------------------------------------+<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">13. Check MySQL<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Open MySQL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u todo_user -p<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>todo_password<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Select database:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>USE todo_db;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Show tables:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SHOW TABLES;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You should see something similar to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>todo<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check records:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM todo;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>+----+------------------+-----------+\n| id | title            | completed |\n+----+------------------+-----------+\n|  1 | Learn Java       | 0         |\n|  2 | Learn Spring Boot| 0         |\n+----+------------------+-----------+<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">14. Understand the complete flow<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">When you click <strong>Add<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>HTML\n |\n | POST \/add\n v\nTodoController\n |\n v\nTodoService\n |\n v\nTodoRepository\n |\n v\nHibernate\/JPA\n |\n v\nMySQL<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>todoRepository.save(todo);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">causes Hibernate to generate an SQL <code>INSERT<\/code> similar to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>INSERT INTO todo\n(title, completed)\nVALUES\n('Learn Spring Boot', false);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">When you open <code>\/<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Browser\n   |\n   v\nController\n   |\n   v\nService\n   |\n   v\nRepository\n   |\n   v\nMySQL\n   |\n   v\nThymeleaf\n   |\n   v\nHTML<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">15. Project structure<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Your final project should look approximately like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>todo\/\n\u2502\n\u251c\u2500\u2500 src\/\n\u2502   \u251c\u2500\u2500 main\/\n\u2502   \u2502   \u251c\u2500\u2500 java\/\n\u2502   \u2502   \u2502   \u2514\u2500\u2500 com\/example\/todo\/\n\u2502   \u2502   \u2502       \u2502\n\u2502   \u2502   \u2502       \u251c\u2500\u2500 TodoApplication.java\n\u2502   \u2502   \u2502       \u2502\n\u2502   \u2502   \u2502       \u251c\u2500\u2500 controller\/\n\u2502   \u2502   \u2502       \u2502   \u2514\u2500\u2500 TodoController.java\n\u2502   \u2502   \u2502       \u2502\n\u2502   \u2502   \u2502       \u251c\u2500\u2500 model\/\n\u2502   \u2502   \u2502       \u2502   \u2514\u2500\u2500 Todo.java\n\u2502   \u2502   \u2502       \u2502\n\u2502   \u2502   \u2502       \u251c\u2500\u2500 repository\/\n\u2502   \u2502   \u2502       \u2502   \u2514\u2500\u2500 TodoRepository.java\n\u2502   \u2502   \u2502       \u2502\n\u2502   \u2502   \u2502       \u2514\u2500\u2500 service\/\n\u2502   \u2502   \u2502           \u2514\u2500\u2500 TodoService.java\n\u2502   \u2502   \u2502\n\u2502   \u2502   \u2514\u2500\u2500 resources\/\n\u2502   \u2502       \u2502\n\u2502   \u2502       \u251c\u2500\u2500 templates\/\n\u2502   \u2502       \u2502   \u2514\u2500\u2500 index.html\n\u2502   \u2502       \u2502\n\u2502   \u2502       \u2514\u2500\u2500 application.properties\n\u2502   \u2502\n\u2502   \u2514\u2500\u2500 test\/\n\u2502\n\u251c\u2500\u2500 pom.xml\n\u2514\u2500\u2500 mvnw<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">What you have learned<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This small project covers the core Spring Boot concepts:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Technology<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td>Spring Boot<\/td><td>Application framework<\/td><\/tr><tr><td>Spring Web<\/td><td>HTTP\/web requests<\/td><\/tr><tr><td>Controller<\/td><td>Handles browser requests<\/td><\/tr><tr><td>Service<\/td><td>Business logic<\/td><\/tr><tr><td>Repository<\/td><td>Database operations<\/td><\/tr><tr><td>JPA\/Hibernate<\/td><td>Java \u2194 SQL mapping<\/td><\/tr><tr><td>MySQL<\/td><td>Persistent database<\/td><\/tr><tr><td>Thymeleaf<\/td><td>HTML templates<\/td><\/tr><tr><td>Maven<\/td><td>Dependency\/build management<\/td><\/tr><tr><td>Eclipse<\/td><td>Development IDE<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Next useful step:<\/strong> add <strong>Edit Todo, validation, Bootstrap styling, REST APIs (<code>GET\/POST\/PUT\/DELETE<\/code>), and a proper database schema<\/strong> so this becomes a more realistic Spring Boot CRUD project.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Absolutely. Since you\u2019ve already been setting up Java + Maven + MySQL + Eclipse on Ubuntu, here is a complete beginner-friendly tutorial to build a Spring Boot Todo Web Application with MySQL. We\u2019ll use: 1. Project architecture We will build:&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7,3,9,8,24,30],"tags":[31,32],"class_list":["post-25","post","type-post","status-publish","format-standard","hentry","category-eclipse","category-java","category-linux","category-maven","category-mysql","category-spring","tag-spring","tag-web"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"Absolutely. Since you\u2019ve already been setting up Java + Maven + MySQL + Eclipse on Ubuntu, here is a complete beginner-friendly tutorial to build a Spring Boot Todo Web Application with MySQL. We\u2019ll use: Java 17+ Maven Spring Boot Spring Web Spring Data JPA MySQL Thymeleaf Eclipse\/STS HTML\/CSS 1. Project architecture We will build: Todo\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"DEVESH\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/boot-code.com\/?p=25\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"boot-code.com - programming tutorials\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Spring Boot Todo Web Application with MySQL - boot-code.com\" \/>\n\t\t<meta property=\"og:description\" content=\"Absolutely. Since you\u2019ve already been setting up Java + Maven + MySQL + Eclipse on Ubuntu, here is a complete beginner-friendly tutorial to build a Spring Boot Todo Web Application with MySQL. We\u2019ll use: Java 17+ Maven Spring Boot Spring Web Spring Data JPA MySQL Thymeleaf Eclipse\/STS HTML\/CSS 1. Project architecture We will build: Todo\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/boot-code.com\/?p=25\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-08T16:14:55+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-08T16:14:57+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Spring Boot Todo Web Application with MySQL - boot-code.com\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Absolutely. Since you\u2019ve already been setting up Java + Maven + MySQL + Eclipse on Ubuntu, here is a complete beginner-friendly tutorial to build a Spring Boot Todo Web Application with MySQL. We\u2019ll use: Java 17+ Maven Spring Boot Spring Web Spring Data JPA MySQL Thymeleaf Eclipse\/STS HTML\/CSS 1. Project architecture We will build: Todo\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/?p=25#blogposting\",\"name\":\"Spring Boot Todo Web Application with MySQL - boot-code.com\",\"headline\":\"Spring Boot Todo Web Application with MySQL\",\"author\":{\"@id\":\"https:\\\/\\\/boot-code.com\\\/?author=1#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/boot-code.com\\\/#organization\"},\"datePublished\":\"2026-10-08T16:14:55+00:00\",\"dateModified\":\"2026-10-08T16:14:57+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/boot-code.com\\\/?p=25#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/boot-code.com\\\/?p=25#webpage\"},\"articleSection\":\"Eclipse, JAVA, Linux, Maven, MySQL, Spring, spring, web\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/?p=25#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/boot-code.com\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/?cat=3#listItem\",\"name\":\"JAVA\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/?cat=3#listItem\",\"position\":2,\"name\":\"JAVA\",\"item\":\"https:\\\/\\\/boot-code.com\\\/?cat=3\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/?p=25#listItem\",\"name\":\"Spring Boot Todo Web Application with MySQL\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/?p=25#listItem\",\"position\":3,\"name\":\"Spring Boot Todo Web Application with MySQL\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/?cat=3#listItem\",\"name\":\"JAVA\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/#organization\",\"name\":\"boot-code.com boot-code.com\",\"description\":\"programming tutorials programming tutorials\",\"url\":\"https:\\\/\\\/boot-code.com\\\/\",\"telephone\":\"+919259571202\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/?author=1#author\",\"url\":\"https:\\\/\\\/boot-code.com\\\/?author=1\",\"name\":\"DEVESH\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/?p=25#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"DEVESH\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/?p=25#webpage\",\"url\":\"https:\\\/\\\/boot-code.com\\\/?p=25\",\"name\":\"Spring Boot Todo Web Application with MySQL - boot-code.com\",\"description\":\"Absolutely. Since you\\u2019ve already been setting up Java + Maven + MySQL + Eclipse on Ubuntu, here is a complete beginner-friendly tutorial to build a Spring Boot Todo Web Application with MySQL. We\\u2019ll use: Java 17+ Maven Spring Boot Spring Web Spring Data JPA MySQL Thymeleaf Eclipse\\\/STS HTML\\\/CSS 1. Project architecture We will build: Todo\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/boot-code.com\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/boot-code.com\\\/?p=25#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/boot-code.com\\\/?author=1#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/boot-code.com\\\/?author=1#author\"},\"datePublished\":\"2026-10-08T16:14:55+00:00\",\"dateModified\":\"2026-10-08T16:14:57+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/boot-code.com\\\/#website\",\"url\":\"https:\\\/\\\/boot-code.com\\\/\",\"name\":\"boot-code.com\",\"description\":\"programming tutorials\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/boot-code.com\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Spring Boot Todo Web Application with MySQL - boot-code.com","description":"Absolutely. Since you\u2019ve already been setting up Java + Maven + MySQL + Eclipse on Ubuntu, here is a complete beginner-friendly tutorial to build a Spring Boot Todo Web Application with MySQL. We\u2019ll use: Java 17+ Maven Spring Boot Spring Web Spring Data JPA MySQL Thymeleaf Eclipse\/STS HTML\/CSS 1. Project architecture We will build: Todo","canonical_url":"https:\/\/boot-code.com\/?p=25","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/boot-code.com\/?p=25#blogposting","name":"Spring Boot Todo Web Application with MySQL - boot-code.com","headline":"Spring Boot Todo Web Application with MySQL","author":{"@id":"https:\/\/boot-code.com\/?author=1#author"},"publisher":{"@id":"https:\/\/boot-code.com\/#organization"},"datePublished":"2026-10-08T16:14:55+00:00","dateModified":"2026-10-08T16:14:57+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/boot-code.com\/?p=25#webpage"},"isPartOf":{"@id":"https:\/\/boot-code.com\/?p=25#webpage"},"articleSection":"Eclipse, JAVA, Linux, Maven, MySQL, Spring, spring, web"},{"@type":"BreadcrumbList","@id":"https:\/\/boot-code.com\/?p=25#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/boot-code.com\/#listItem","position":1,"name":"Home","item":"https:\/\/boot-code.com\/","nextItem":{"@type":"ListItem","@id":"https:\/\/boot-code.com\/?cat=3#listItem","name":"JAVA"}},{"@type":"ListItem","@id":"https:\/\/boot-code.com\/?cat=3#listItem","position":2,"name":"JAVA","item":"https:\/\/boot-code.com\/?cat=3","nextItem":{"@type":"ListItem","@id":"https:\/\/boot-code.com\/?p=25#listItem","name":"Spring Boot Todo Web Application with MySQL"},"previousItem":{"@type":"ListItem","@id":"https:\/\/boot-code.com\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/boot-code.com\/?p=25#listItem","position":3,"name":"Spring Boot Todo Web Application with MySQL","previousItem":{"@type":"ListItem","@id":"https:\/\/boot-code.com\/?cat=3#listItem","name":"JAVA"}}]},{"@type":"Organization","@id":"https:\/\/boot-code.com\/#organization","name":"boot-code.com boot-code.com","description":"programming tutorials programming tutorials","url":"https:\/\/boot-code.com\/","telephone":"+919259571202"},{"@type":"Person","@id":"https:\/\/boot-code.com\/?author=1#author","url":"https:\/\/boot-code.com\/?author=1","name":"DEVESH","image":{"@type":"ImageObject","@id":"https:\/\/boot-code.com\/?p=25#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514?s=96&d=mm&r=g","width":96,"height":96,"caption":"DEVESH"}},{"@type":"WebPage","@id":"https:\/\/boot-code.com\/?p=25#webpage","url":"https:\/\/boot-code.com\/?p=25","name":"Spring Boot Todo Web Application with MySQL - boot-code.com","description":"Absolutely. Since you\u2019ve already been setting up Java + Maven + MySQL + Eclipse on Ubuntu, here is a complete beginner-friendly tutorial to build a Spring Boot Todo Web Application with MySQL. We\u2019ll use: Java 17+ Maven Spring Boot Spring Web Spring Data JPA MySQL Thymeleaf Eclipse\/STS HTML\/CSS 1. Project architecture We will build: Todo","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/boot-code.com\/#website"},"breadcrumb":{"@id":"https:\/\/boot-code.com\/?p=25#breadcrumblist"},"author":{"@id":"https:\/\/boot-code.com\/?author=1#author"},"creator":{"@id":"https:\/\/boot-code.com\/?author=1#author"},"datePublished":"2026-10-08T16:14:55+00:00","dateModified":"2026-10-08T16:14:57+00:00"},{"@type":"WebSite","@id":"https:\/\/boot-code.com\/#website","url":"https:\/\/boot-code.com\/","name":"boot-code.com","description":"programming tutorials","inLanguage":"en-US","publisher":{"@id":"https:\/\/boot-code.com\/#organization"}}]},"og:locale":"en_US","og:site_name":"boot-code.com - programming tutorials","og:type":"article","og:title":"Spring Boot Todo Web Application with MySQL - boot-code.com","og:description":"Absolutely. Since you\u2019ve already been setting up Java + Maven + MySQL + Eclipse on Ubuntu, here is a complete beginner-friendly tutorial to build a Spring Boot Todo Web Application with MySQL. We\u2019ll use: Java 17+ Maven Spring Boot Spring Web Spring Data JPA MySQL Thymeleaf Eclipse\/STS HTML\/CSS 1. Project architecture We will build: Todo","og:url":"https:\/\/boot-code.com\/?p=25","article:published_time":"2026-10-08T16:14:55+00:00","article:modified_time":"2026-10-08T16:14:57+00:00","twitter:card":"summary_large_image","twitter:title":"Spring Boot Todo Web Application with MySQL - boot-code.com","twitter:description":"Absolutely. Since you\u2019ve already been setting up Java + Maven + MySQL + Eclipse on Ubuntu, here is a complete beginner-friendly tutorial to build a Spring Boot Todo Web Application with MySQL. We\u2019ll use: Java 17+ Maven Spring Boot Spring Web Spring Data JPA MySQL Thymeleaf Eclipse\/STS HTML\/CSS 1. Project architecture We will build: Todo"},"aioseo_meta_data":{"post_id":"25","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"limit_modified_date":false,"ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-10-08 16:14:57","updated":"2026-10-08 16:46:50"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/boot-code.com\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/boot-code.com\/?cat=3\" title=\"JAVA\">JAVA<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tSpring Boot Todo Web Application with MySQL\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/boot-code.com\/"},{"label":"JAVA","link":"https:\/\/boot-code.com\/?cat=3"},{"label":"Spring Boot Todo Web Application with MySQL","link":"https:\/\/boot-code.com\/?p=25"}],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/boot-code.com\/index.php?rest_route=\/wp\/v2\/posts\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/boot-code.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/boot-code.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/boot-code.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/boot-code.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=25"}],"version-history":[{"count":1,"href":"https:\/\/boot-code.com\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":26,"href":"https:\/\/boot-code.com\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions\/26"}],"wp:attachment":[{"href":"https:\/\/boot-code.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/boot-code.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/boot-code.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}