Spring Boot — Run, Test & Checklist
July 19, 2025
Run the app and exercise the API — plus the quick fixes and the marking checklist.
Run
- Find the main class (
IndexNoApplication.java) and run it, or from a terminal in the project folder:
mvn spring-boot:run
- 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/1with a JSON body. - Delete:
DELETE http://localhost:8080/api/items/1
Quick fixes
- App won't start / "Unknown database" → the name after the last
/inapplication.propertiesdoesn'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.javadoesn't match the table column; add@Column(name = "..."). - Restored data disappeared →
ddl-autowascreateorcreate-drop. Useupdate. - Port 8080 already in use → add
server.port=8081toapplication.properties.
Marking checklist — tick before you submit
- (i) Project named with your
IndexNo+ the 4 dependencies added. - (ii) Database created, backup restored,
application.propertiesfilled in, app connects. - (iii)
Item.javawith@Entity, all 4 fields, both constructors, all getters/setters. - (iv)
ItemRepositoryinterface +ItemControllerwith all 5 CRUD methods, tested and working.
Back to the overview: [[spring-boot-basics]].