Build a Task Manager REST API
Build a Spring Boot REST API with full CRUD operations on a MySQL database.
Introduction
30 Second Summary
Every app you use daily has a backend that creates, reads, updates, and deletes data. That pattern is called CRUD, and it is the foundation of backend development.
In this project, you will build a Task Manager REST API using Spring Boot and MySQL. You will create endpoints that handle full CRUD operations and test them with Postman.
What You'll Build
A Task Manager REST API that lets you create, read, update, and delete tasks stored in a MySQL database, responding with JSON over HTTP.
By the end of this project, you'll have:
- A Spring Boot application connected to your local MySQL database.
- A JPA entity and Spring Data repository that handles database operations with zero SQL.
- A REST controller with 5 endpoints (GET all, GET by ID, POST, PUT, DELETE) tested using Postman.
- Secret Mission: Add filtering by completion status and search by title to your API.
Are there any prerequisites?
You need JDK 17 or higher and MySQL installed and running on your machine. You also need VS Code. Step 1 walks you through verifying your setup and installing any remaining tools.
Before We Start
Before you can build a REST API, you need to make sure your development environment is ready. This step focuses on confirming your Java version, generating a starter project, and installing the tool you will use to test your API.
Once these are in place, you will have everything needed to start writing code in the next step.
In this step, get ready to:
- Confirm JDK 17+ is installed and working.
- Generate a Spring Boot project with Spring Initializr.
- Install Postman for API testing.
Verify your JDK version
Spring Boot 3.5.14 requires Java 17 or higher. You likely already have a JDK installed, but you need to confirm it meets the minimum version.
- Open the integrated terminal in VS Code by pressing Ctrl+` (Windows) or Control+` (macOS).
- Check your Java version by running this command:
java -version
You should see output that includes a version number like 17.x.x or higher.
✔️ I see version 17 or higher
Your JDK is compatible with Spring Boot 3.5.14. You are ready to move on.
ⓧ I see an older version
Your current JDK is too old for this project. You need to install JDK 17 or later.
- Download and install JDK 17 from Oracle or an OpenJDK distribution (such as Adoptium).
- After installing, close and reopen your terminal in VS Code.
- Run java -version again to confirm it now shows 17 or higher.
Why might the old version still show up?
Some systems have multiple Java versions installed. If your terminal still shows the old version after installing JDK 17, you may need to update your system PATH so the new JDK comes first. Refer to the installation instructions from your JDK provider for platform-specific guidance.
ⓧ Command not found
Java is not installed or not available on your system PATH.
- Download and install JDK 17 or later from Oracle or an OpenJDK distribution (such as Adoptium).
- Follow the installer prompts and accept the default options.
- Close and reopen the terminal in VS Code after installation.
- Run java -version again to confirm it shows 17 or higher.
Still seeing command not found?
Make sure the JDK installation directory is added to your system PATH variable. On Windows, you may need to restart VS Code entirely for PATH changes to take effect.
help me fix java not found on my system PATH after installing JDK
Generate your Spring Boot project
Spring Initializr is a web tool that generates a ready-to-run Spring Boot project. It creates all the boilerplate files, build configuration, and folder structure so you can jump straight into writing code.
- Open your browser and go to start.spring.io.
- Under Project, select Maven.
- Under Language, select Java.
- Under Spring Boot, select 3.5.14.
- In Project Metadata, set Group to com.example.
- Set Artifact to taskmanager.
- Click ADD DEPENDENCIES and search for Spring Web. Select it.
- Search for Spring Data JPA and select it.
- Search for MySQL Driver and select it.
- Click GENERATE to download the ZIP file.
What is Spring Initializr doing for you?
Spring Initializr creates a Maven project with a pom.xml that lists all your dependencies. It also includes a Maven wrapper (mvnw.cmd on Windows) so you do not need Maven installed globally.
The three dependencies you selected give you web request handling (Spring Web), database access (Spring Data JPA), and the MySQL database driver.
- Find the downloaded taskmanager.zip file in your Downloads folder.
- Extract (unzip) the file. This creates a taskmanager folder.
- In VS Code, click File in the top menu bar.
- Click Open Folder.
- Navigate to the extracted taskmanager folder and click Select Folder.
You should see the project files appear in the VS Code Explorer sidebar, including pom.xml, the src folder, and mvnw.cmd.
Don't see the project files?
Make sure you opened the taskmanager folder itself, not the parent folder containing it. The pom.xml should be at the top level of the opened folder.
help me open the correct folder for my Spring Boot project in VS Code
Download and install Postman
Postman is the industry-standard tool for testing REST APIs. You will use it to send HTTP requests to your API and inspect the responses.
- Open your browser and go to postman.com/downloads.
- Download the installer for your operating system.
- Run the installer and follow the prompts to complete the installation.
- Open Postman after installation. It will prompt you to create a free account or sign in.
- Create a free account, or click Skip and go to the app if you prefer not to sign in.
Why Postman?
Postman provides a visual interface for sending HTTP requests. Instead of wrestling with command-line JSON formatting, you get a clean form where you can pick the HTTP method, enter a URL, and write a JSON body.
Postman not opening?
On Windows, you may need to allow Postman through your firewall or antivirus. On macOS, you may need to go to System Settings and allow the app under Privacy & Security.
help me get Postman running on my computer
Your environment is ready. Next up, you will connect your project to MySQL and configure the database.
Configure Your MySQL Database
Your Spring Boot project is ready in VS Code with all the right dependencies. Now you need a place for the API to store its data.
In this step, you will create a MySQL database and tell Spring Boot how to connect to it. Once this connection is configured, Spring Boot will automatically talk to your database every time the API handles a request.
In this step, get ready to:
- Create a MySQL database for the project.
- Configure Spring Boot to connect to your database.
Create the MySQL database
Spring Boot needs an existing database to connect to. You will create one called taskmanager using the MySQL command line.
- Open the MySQL Command Line Client on your computer.
- Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
- Type MySQL and select MySQL Command Line Client (or open your preferred MySQL client).
- Enter your MySQL root password when prompted.
- Create the project database by running this command:
CREATE DATABASE taskmanager;
What does this command do?
CREATE DATABASE taskmanager; tells MySQL to create a new, empty database called taskmanager.
Spring Boot will use this database to store all the task data your API manages. The database starts empty. Spring Boot will create the tables for you automatically when you run the application later.
- Verify the database was created by running:
SHOW DATABASES;
- You should see taskmanager in the list of databases.
Don't see the database?
- Make sure you typed the semicolon at the end of the command. MySQL commands must end with ; to execute.
- If you see an access denied error, make sure you logged in as the root user or a user with CREATE privileges.
Help me fix my MySQL CREATE DATABASE error
Configure Spring Boot to connect to MySQL
Spring Boot uses a file called application.properties to know where the database is and how to authenticate. Without this configuration, the application cannot start.
- In VS Code, open src/main/resources/application.properties using the Explorer sidebar.
- Replace the file contents with this configuration:
spring.datasource.url=jdbc:mysql://localhost:3306/taskmanager
spring.datasource.username=root
spring.datasource.password=your-mysql-password-here
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
- Replace your-mysql-password-here with the actual password you use to log in to MySQL.
What do these properties mean?
- spring.datasource.url tells Spring Boot where to find your MySQL server and which database to use.
- spring.datasource.username and spring.datasource.password are your MySQL login credentials.
- spring.jpa.hibernate.ddl-auto=update tells JPA to automatically create or update database tables based on your Java code.
- spring.jpa.show-sql=true prints every SQL query to the console so you can see what Spring Boot is doing behind the scenes.
- Save application.properties.
Not sure what your MySQL password is?
This is the password you set when you first installed MySQL. If you left it blank during installation, try removing the entire spring.datasource.password line or leaving the value empty.
Help me figure out my MySQL password
✔️ Awesome, I've got everything!
Great. Double check you have saved application.properties before moving on.
ⓧ I'd like to double check the full code
spring.datasource.url=jdbc:mysql://localhost:3306/taskmanager
spring.datasource.username=root
spring.datasource.password=your-mysql-password-here
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
Your database is ready and Spring Boot knows how to reach it. Next up, you will create the Java class that defines what a "task" looks like in your database.
Create the Task Entity and Repository
Your Spring Boot project is connected to MySQL and ready to store data. Now you need to define what gets stored.
In this step, you will create the data model that represents a task and the repository layer that handles all database operations. Together, these two files form the foundation your REST controller will build on.
In this step, get ready to:
- Create a JPA entity class that maps to a MySQL table.
- Create a Spring Data repository interface that provides CRUD operations automatically.
Create the Task entity class
A JPA entity is a plain Java class that maps directly to a database table. Each field in the class becomes a column in the table. Spring Boot uses Hibernate under the hood to translate your Java objects into SQL statements.
- In the VS Code Explorer sidebar, navigate to src/main/java/com/example/taskmanager/.
- Right-click the taskmanager folder and select New File.
- Name the file Task.java and paste the following code:
package com.example.taskmanager;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
// Marks this class as a database table
@Entity
public class Task {
// Primary key with auto-increment in MySQL
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
private String description;
private boolean completed;
// JPA requires a no-argument constructor
public Task() {
}
// Getters and setters let Spring read and write each field
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isCompleted() {
return completed;
}
public void setCompleted(boolean completed) {
this.completed = completed;
}
}
What does this code do?
This class defines the shape of a task in your database. Each annotation plays a specific role:
- @Entity tells JPA to create a task table in MySQL based on this class.
- @Id marks id as the primary key.
- @GeneratedValue(strategy = GenerationType.IDENTITY) lets MySQL auto-increment the ID for each new task.
- The no-argument constructor is required by JPA to create instances when reading from the database.
- Getters and setters allow Spring to serialize tasks to JSON and deserialize JSON back into Task objects.
- Save Task.java.
- You won't see a visible change yet. The next substep creates the repository that uses this entity.
Seeing red underlines on the imports?
If VS Code shows errors on the jakarta.persistence imports, your project may not have downloaded its dependencies yet. Open the VS Code terminal and run:
.\mvnw.cmd dependency:resolve
This downloads all the libraries defined in pom.xml. The red underlines should disappear after a few seconds.
Also make sure you are importing from jakarta.persistence, not javax.persistence. Spring Boot 3.x uses the Jakarta namespace.
Help me fix import errors in my Task.java entity file.
✔️ Awesome, I've got everything!
Great. Make sure you have saved Task.java before moving on.
ⓧ I'd like to double check the full code
package com.example.taskmanager;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class Task {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
private String description;
private boolean completed;
public Task() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isCompleted() {
return completed;
}
public void setCompleted(boolean completed) {
this.completed = completed;
}
}
Create the TaskRepository interface
Spring Data JPA can generate all the SQL you need from a single interface declaration. You define the interface, and Spring provides the implementation at runtime.
- Right-click the taskmanager folder again and select New File.
- Name the file TaskRepository.java and paste the following code:
package com.example.taskmanager;
import org.springframework.data.jpa.repository.JpaRepository;
// Spring automatically implements CRUD methods (save, findAll, findById, delete)
public interface TaskRepository extends JpaRepository<Task, Long> {
}
What does this code do?
By extending JpaRepository<Task, Long>, Spring Data JPA automatically provides methods like save(), findAll(), findById(), and delete(). You do not write a single line of SQL.
The two type parameters tell Spring which entity to manage (Task) and what type its primary key is (Long).
- Save TaskRepository.java.
- You won't see a change yet. When you run the application in a later step, Spring will automatically create a task table in your MySQL database based on this entity and repository.
Red underline on JpaRepository?
Make sure spring-boot-starter-data-jpa is listed in your pom.xml dependencies. If you downloaded the project from Spring Initializr with the correct dependencies, it should already be there.
If the error persists, try running .\mvnw.cmd dependency:resolve in your terminal to download missing libraries.
Help me fix the JpaRepository import error in my TaskRepository file.
✔️ Awesome, I've got everything!
Great. Make sure you have saved TaskRepository.java before moving on.
ⓧ I'd like to double check the full code
package com.example.taskmanager;
import org.springframework.data.jpa.repository.JpaRepository;
public interface TaskRepository extends JpaRepository<Task, Long> {
}
Why zero SQL?
Spring Data JPA uses the method names and type parameters you provide to generate SQL queries at runtime. The ddl-auto=update setting in application.properties tells Hibernate to create or update database tables automatically based on your entity classes.
This means you define your data model in Java and never touch raw SQL for basic CRUD operations.
Your data model and repository are ready. Next up, you will build the REST controller that exposes these operations as HTTP endpoints.
Build the REST Controller
You now have a Task entity and a TaskRepository that can perform database operations. The missing piece is a way for the outside world to reach your data.
A REST controller is the layer that listens for HTTP requests and delegates work to the repository. In this step, you will build a controller with five endpoints covering every CRUD operation: create, read, update, and delete.
In this step, get ready to:
- Create the TaskController class with read endpoints.
- Add create, update, and delete endpoints.
Create the controller with read endpoints
The @RestController annotation tells Spring Boot that this class handles HTTP requests and returns data as JSON. The @RequestMapping sets a base URL so every endpoint starts with /api/tasks.
- In VS Code, right-click the src/main/java/com/example/taskmanager/ folder in the Explorer sidebar.
- Click New File and name it TaskController.java.
- Paste the following code into the new file:
package com.example.taskmanager;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/tasks")
public class TaskController {
private final TaskRepository taskRepository;
// Spring injects the repository automatically via constructor
public TaskController(TaskRepository taskRepository) {
this.taskRepository = taskRepository;
}
// GET /api/tasks - returns every task in the database
@GetMapping
public List<Task> getAllTasks() {
return taskRepository.findAll();
}
// GET /api/tasks/{id} - returns one task, or 404 if not found
@GetMapping("/{id}")
public ResponseEntity<Task> getTaskById(@PathVariable Long id) {
return taskRepository.findById(id)
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
}
}
What does this code do?
- @RestController marks this class as a REST endpoint handler. Spring converts return values to JSON automatically.
- @RequestMapping("/api/tasks") sets the base path for all endpoints in this controller.
- The constructor takes TaskRepository as a parameter. Spring sees this and automatically injects the repository instance.
- getAllTasks() calls findAll() on the repository to return every task in the database.
- getTaskById() looks up a single task. If found, it returns the task with a 200 status. If not, it returns a 404.
- Save TaskController.java.
Seeing red underlines in the file?
- Make sure the file is inside src/main/java/com/example/taskmanager/. If the package path is wrong, the imports will not resolve.
- Confirm the first line reads package com.example.taskmanager; and matches the folder path exactly.
- Why is my TaskController showing import errors?
Add create, update, and delete endpoints
Reading data is only half the story. Your API also needs to accept new tasks, update existing ones, and remove tasks that are no longer needed.
- In TaskController.java, find the closing brace of the getTaskById method.
- Add the following three methods below it, before the final closing brace of the class:
// POST /api/tasks - saves a new task to the database
@PostMapping
public Task createTask(@RequestBody Task task) {
return taskRepository.save(task);
}
// PUT /api/tasks/{id} - updates all fields of an existing task
@PutMapping("/{id}")
public ResponseEntity<Task> updateTask(@PathVariable Long id, @RequestBody Task taskDetails) {
return taskRepository.findById(id)
.map(task -> {
task.setTitle(taskDetails.getTitle());
task.setDescription(taskDetails.getDescription());
task.setCompleted(taskDetails.isCompleted());
return ResponseEntity.ok(taskRepository.save(task));
})
.orElse(ResponseEntity.notFound().build());
}
// DELETE /api/tasks/{id} - removes a task from the database
@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteTask(@PathVariable Long id) {
return taskRepository.findById(id)
.map(task -> {
taskRepository.delete(task);
return ResponseEntity.ok().<Void>build();
})
.orElse(ResponseEntity.notFound().build());
}
What does this code do?
- createTask() uses @RequestBody to convert incoming JSON into a Task object, then saves it to MySQL.
- updateTask() looks up the task by ID. If found, it overwrites title, description, and completed status, then saves. If not found, it returns a 404.
- deleteTask() follows the same find-or-404 pattern. If the task exists, it removes it from the database entirely.
- The .map().orElse() pattern handles the "found vs not found" logic cleanly in one chain.
Why these four HTTP methods?
REST APIs use different HTTP methods to signal intent. GET retrieves data. POST creates new data. PUT replaces existing data. DELETE removes data.
This convention means any developer (or tool like Postman) can predict how your API behaves just by looking at the method and URL.
- Save TaskController.java.
- Confirm there are no red underlines or syntax errors in the file.
Seeing errors on ResponseEntity or the annotations?
- Check that your imports at the top include import org.springframework.http.ResponseEntity; and import org.springframework.web.bind.annotation.*;.
- Make sure you placed the new methods inside the class braces, not after them.
- My controller code has errors after adding the write methods. Help me fix them.
✔️ Awesome, I've got everything!
Great. Double check you have saved TaskController.java with no errors.
ⓧ I'd like to double check the full code
Here is the complete TaskController.java file. Make sure yours matches exactly.
package com.example.taskmanager;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/tasks")
public class TaskController {
private final TaskRepository taskRepository;
public TaskController(TaskRepository taskRepository) {
this.taskRepository = taskRepository;
}
@GetMapping
public List<Task> getAllTasks() {
return taskRepository.findAll();
}
@GetMapping("/{id}")
public ResponseEntity<Task> getTaskById(@PathVariable Long id) {
return taskRepository.findById(id)
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
}
@PostMapping
public Task createTask(@RequestBody Task task) {
return taskRepository.save(task);
}
@PutMapping("/{id}")
public ResponseEntity<Task> updateTask(@PathVariable Long id, @RequestBody Task taskDetails) {
return taskRepository.findById(id)
.map(task -> {
task.setTitle(taskDetails.getTitle());
task.setDescription(taskDetails.getDescription());
task.setCompleted(taskDetails.isCompleted());
return ResponseEntity.ok(taskRepository.save(task));
})
.orElse(ResponseEntity.notFound().build());
}
@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteTask(@PathVariable Long id) {
return taskRepository.findById(id)
.map(task -> {
taskRepository.delete(task);
return ResponseEntity.ok().<Void>build();
})
.orElse(ResponseEntity.notFound().build());
}
}
Your controller is complete. You have five endpoints covering every CRUD operation. Next up, you will start the application and test each endpoint with Postman to see your API in action.
Run and Test Your API
You've built all three layers of your Spring Boot application. The entity maps to your database, the repository handles persistence, and the controller exposes your endpoints.
Now it's time to start the application and prove it works. You'll launch the server, watch Hibernate auto-create your database table, and then hit every endpoint using Postman to confirm the full create-read-update-delete cycle.
In this step, get ready to:
- Start the Spring Boot application with the Maven wrapper.
- Create and read tasks using POST and GET requests in Postman.
- Update and delete tasks using PUT and DELETE requests in Postman.
Start your Spring Boot application
The Maven wrapper that came with your project can compile and launch your application without needing a global Maven install.
- In VS Code, open the integrated terminal by pressing Ctrl+` (macOS and Windows).
- Make sure you are inside the taskmanager project folder (the one containing pom.xml).
- Start the application by running this command:
.\mvnw.cmd spring-boot:run
What does this command do?
The Maven wrapper (mvnw.cmd) downloads all the dependencies listed in pom.xml, compiles your Java source files, and then starts the embedded Tomcat web server.
On first run, it downloads several libraries, so it may take a minute or two. Subsequent starts are much faster.
Wait for the terminal output to display a line containing Started TaskManagerApplication. This confirms your API is live at http://localhost:8080.
What happened in MySQL?
Because you set spring.jpa.hibernate.ddl-auto=update, Hibernate automatically created a task table in your taskmanager database. You didn't write a single line of SQL.
You can also see the SQL statements Hibernate generated in the terminal because spring.jpa.show-sql=true prints them.
Application won't start?
If you see a connection error mentioning Communications link failure, confirm MySQL is running. Open your MySQL client and run a quick SELECT 1 to verify.
If you see Access denied, double-check the username and password in application.properties. They must match your MySQL credentials.
If port 8080 is already in use, stop whatever process is using it and try again.
Help me troubleshoot my Spring Boot startup error.
Create and retrieve a task with Postman
Your API is running. Time to send it real HTTP requests and see data flow into MySQL and back.
- Open Postman.
- Click the + button to create a new request tab.
- Change the method dropdown from GET to POST.
- Enter http://localhost:8080/api/tasks in the URL field.
- Click the Body tab below the URL.
- Select raw, then change the dropdown from Text to JSON.
- Paste the following JSON into the body area:
{
"title": "Learn Spring Boot",
"description": "Build a REST API",
"completed": false
}
- Click Send.
You should see a JSON response in the lower panel containing your task with an auto-generated id field (likely 1).
What just happened?
Postman sent an HTTP POST request with your JSON body. Spring Boot deserialized it into a Task object, the repository saved it to MySQL, and the response returned the saved entity including its generated id.
Now confirm you can read it back from the database.
- Click the + button to open a new request tab.
- Leave the method as GET.
- Enter http://localhost:8080/api/tasks in the URL field.
- Click Send.
You should see a JSON array containing the task you just created. The data is coming from MySQL, not from memory.
Seeing an empty array or 404?
If the GET returns an empty array [], your POST request may not have succeeded. Go back to the POST tab and check the response status. It should be 200.
If you see a 404 error, make sure the URL is exactly http://localhost:8080/api/tasks with no trailing slash or typos.
Help me debug my Postman request to the Spring Boot API.
Update and delete a task
You've proven POST and GET work. Now test the remaining two operations to complete the full CRUD cycle.
- Click the + button to open a new request tab.
- Change the method dropdown to PUT.
- Enter http://localhost:8080/api/tasks/1 in the URL field.
- Click the Body tab below the URL.
- Select raw, then change the dropdown to JSON.
- Paste the following JSON to mark the task as completed:
{
"title": "Learn Spring Boot",
"description": "Build a REST API",
"completed": true
}
- Click Send.
The response should show the same task but with "completed": true. The PUT endpoint found the task by ID, updated all its fields, and saved it back to MySQL.
Why send all fields in a PUT request?
A PUT request replaces the entire resource. If you only sent "completed": true without title and description, those fields would be set to null. That's the standard behavior of PUT in REST APIs.
Now delete the task entirely.
- Click the + button to open a new request tab.
- Change the method dropdown to DELETE.
- Enter http://localhost:8080/api/tasks/1 in the URL field.
- Click Send.
You should receive a 200 status with an empty response body. The task has been removed from MySQL.
Verify the deletion by sending one final GET request.
- Switch back to your GET request tab from earlier.
- Click Send again.
The response should now be an empty array []. Your task is gone from the database.
PUT or DELETE returning 404?
A 404 response means no task exists with that ID. If you've been testing and already deleted task 1, create a new task with POST first, then use the ID from that response in your PUT or DELETE URL.
Help me fix my PUT or DELETE request that's returning an error.
You've just tested all five endpoints of a fully functional REST API. Your Spring Boot application receives HTTP requests, processes them through the controller, persists data via JPA, and responds with JSON. That's the exact pattern behind production Java backends.
Secret mission
Add Filtering and Search
Your API can create, read, update, and delete tasks. But what if you have hundreds of tasks and only want to see the completed ones? Or you need to find a specific task by name? Add filtering and search endpoints to make your API production-ready.
Clean Up Your Resources
Clean Up Your Resources
Decide whether to keep your resources running, pause them to come back later, or delete them entirely. This project runs entirely locally with MySQL, so there are no ongoing cloud costs.
Resources you used:
- MySQL taskmanager database on localhost.
- Spring Boot taskmanager project folder.
- Postman application.
Keep everything running
No action needed. Choose this if you're still actively building or want to keep experimenting with your API.
- Your Spring Boot app continues running at http://localhost:8080 until you close the terminal.
- Your MySQL taskmanager database stays on your machine with all your task data.
- Postman stays installed for future API testing.
Pause - I'll come back to this later
Shut down the running Spring Boot process to free up your terminal and port 8080. Your files and database stay intact so you can restart anytime.
- Switch to the terminal where Spring Boot is running and press Ctrl+C to stop the application.
- Your project folder and MySQL database remain on your machine.
- To restart later, open the project folder in VS Code and run .\mvnw.cmd spring-boot:run in the terminal.
Delete - I don't want to use this again
Remove all project resources and start fresh. This deletes your code, database, and test data permanently.
- Stop the Spring Boot app by pressing Ctrl+C in the terminal where it is running.
- Drop the MySQL database by opening your MySQL command line and running:
DROP DATABASE taskmanager;
- Delete the project folder. On macOS/Linux, run:
cd ~/Desktop
rm -rf taskmanager
On Windows, run:
cd ~/Desktop
rmdir /s /q taskmanager
- To uninstall Postman on macOS, drag the Postman app from your Applications folder to the Trash. On Windows, open Settings, select Apps, find Postman in the list, and click Uninstall.
Nice Work!
Nice Work!
You did it. You just built a professional-grade REST API with Java, Spring Boot, and MySQL.
This is the exact stack that powers backend services at companies of every size. You now have hands-on proof that you can build one from scratch.
Here's what you accomplished:
- Built a Spring Boot application connected to a MySQL database using a JPA entity that maps directly to a database table.
- Implemented a Spring Data repository that handles all CRUD operations automatically with zero SQL.
- Created a REST controller with GET, POST, PUT, and DELETE endpoints, then tested every one in Postman.
- Added filtering and search functionality using Spring Data query methods that generate SQL automatically from method names.
Ready to quiz yourself?