💾Thananjhayan
← Back to notes

Spring Boot — Run, Test & Checklist

July 19, 2025

Run the app and exercise the API — plus the quick fixes and the marking checklist.

Run

  1. Find the main class (IndexNoApplication.java) and run it, or from a terminal in the project folder:
mvn spring-boot:run
  1. Wait until the console shows "Started … Application". The app now runs at http://localhost:8080.

Test

  • Get all items (browser): http://localhost:8080/api/items
  • Auto REST endpoint: http://localhost:8080/items

To create an item, use Postman: POST to http://localhost:8080/api/items → Body → raw → JSON:

{
  "itemName": "Pen",
  "unitPrice": 50,
  "updatedDate": "2026-07-24"
}
  • Update: PUT http://localhost:8080/api/items/1 with a JSON body.
  • Delete: DELETE http://localhost:8080/api/items/1

Quick fixes

  • App won't start / "Unknown database" → the name after the last / in application.properties doesn't match your real database name.
  • "Access denied for user root" → wrong MySQL password in application.properties.
  • "Unknown column" / data not showing → a field name in Item.java doesn't match the table column; add @Column(name = "...").
  • Restored data disappearedddl-auto was create or create-drop. Use update.
  • Port 8080 already in use → add server.port=8081 to application.properties.

Marking checklist — tick before you submit

  • (i) Project named with your IndexNo + the 4 dependencies added.
  • (ii) Database created, backup restored, application.properties filled in, app connects.
  • (iii) Item.java with @Entity, all 4 fields, both constructors, all getters/setters.
  • (iv) ItemRepository interface + ItemController with all 5 CRUD methods, tested and working.

Back to the overview: [[spring-boot-basics]].

💬 Comments