Example application using Postgres JSON aggregates and Jackson to deserialize domain models (example for this blog post )
The application is a spring boot rest api with endpoints that can read Questionnaires
from postgres
GET /questionnaires
GET /questionnaires/{id}
Given this schema:
We can use Postgres' json_agg
and json_build_object
functions to build JSON objects on read that can be easily deserialized by Jackson
Make sure you have postgres running locally and create a database questionnaire_example
> pqsl
> CREATE DATABASE questionnaire_example;
Run the spring boot server (migrations will happen automatically):
> ./gradlew bootRun
Then visit http://localhost:8080/questionnaires
to see the questionnaires responses