In this example you can see how to use Envers for Auditing your tables.
This is a Spring Boot Application and it is configured with h2 (in-memory) database.
There are the following entities:
- AuditEnversInfo --> auditory master table
- User --> User table
- UserOrganisations --> User Organisation mapping table with preferred attribute
- Organisation --> Organisation
For each table (entity) the framework will create the auditory tables.
-
Since the current version, it is not necessary create manually the schema, when the application startup, it will create the schema and the entities.
-
Compile the project with the following command:
mvn clean install
-
You can run the application inside of your ide from
com.envers.ExampleEnversApplication.java
or from terminal with the following command:mvn spring-boot:run
I used the postman as a client to test the endpoints, you can import the collection, the file is in:
/resources/endpoints/envers-audit-query-v1.postman_collection.json
Or if you prefer, you can see the Controllers inside of com.envers.web