This is an example application for Micronaut Data using an Oracle JSON Duality View.
It uses a test container with the container image "gvenzl/oracle-free:latest-faststart" by default and then the datasource configuration is taken from the container before starting Micronaut application context.
Note: To run the application you need a Docker-API compatible container runtime such as Docker, Podman, or Rancher Desktop installed and running.
To get started, run the application as follows:
./gradlew run
Wait until the application has started and created the database schema.
Test the application by using curl to call the API.
-
List all the students and their schedules:
curl http://localhost:8080/students
-
Retrieve a schedule by student name:
curl http://localhost:8080/students/student/Jill
-
Retrieve a schedule by student id:
curl http://localhost:8080/students/3
-
Create a new student with courses (and view that student's schedule):
curl -d '{"student":"Sandro", "averageGrade":8.9, "courses": ["Math", "English"]}' \ -H "Content-Type: application/json" \ -X POST http://localhost:8080/students
-
Update a student's average grade (by student id):
curl -X PUT http://localhost:8080/students/1/average_grade/9.8
-
Retrieve the maximum average grade:
curl http://localhost:8080/students/max_average_grade
-
Update a student's name (by student id), for example, to correct a typo:
curl -X PUT http://localhost:8080/students/1/student/Dennis
-
Delete a student by student id and retrieve the new maximum average grade (to confirm deletion):
curl -X DELETE http://localhost:8080/students/1 curl http://localhost:8080/students/max_average_grade