Spring Boot Javers Integration


Spring Boot Javers Integration:

Spring Boot has become a standard in the world of Java enterprise applications.
Our Spring Boot starters simplify integrating JaVers with your application. All required JaVers beans are created and auto-configured with reasonable defaults.
There are two starters compatible with Spring Data and common persistence stacks:
Get JaVers Spring Boot starter
MongoDB starter
Add JaVers MongoDB and Spring Data MongoDB starters to your classpath:
compile 'org.javers:javers-spring-boot-starter-mongo:5.6.3'
compile 'org.springframework.boot:spring-boot-starter-data-mongodb:' + $SPRING_BOOT_VERSION  
SQL starter
Add JaVers SQL and Spring Data JPA starters to your classpath:
compile 'org.javers:javers-spring-boot-starter-sql:5.6.3'
compile 'org.springframework.boot:spring-boot-starter-data-jpa:' + $SPRING_BOOT_VERSION  
Check Maven Central for other build tool snippets.

In this example, we’ll show you, how we can save the history of object/fields etc., and retrieve only those data as per need.

In this example, we’ve used latest version of Spring Boot 2.1.6.RELEASE, Javers and JPA version as of today.

Steps to execute the project.
1.      Execute the schema.sql followed by data.sql attached in the source code.
2.      Then simply hit the end-point : http://localhost:8080/swagger-ui.html#/
3.      Simply hit /test-javers/{salary} endpoint, should see 200 OK
4.      Execute the same endpoint by changing, value to 5000

5.      Now, if you can see have created many endpoints to get different types of changed data using different method provided by Javers

Note: All the description about the end-point has been mentioned in the code.

Comments

Popular posts from this blog

Install Redis on Oracle Linux 7+