Spring Boot + Elasticsearch codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API
This codebase was created to demonstrate a fully fledged fullstack application built with Java + Spring Boot + Elasticsearch including CRUD operations, authentication, routing, pagination, and more.
We've gone to great lengths to adhere to the Java + Spring Boot + Elasticsearch community styleguides & best practices.
For more information on how to this works with other frontends/backends, head over to the RealWorld repo.
The application was made mainly demonstrate the new Elasticsearch Java API Client.
The application was built with:
- Java as programming language
- Spring Boot as dependency injection framework
- Gradle as build tool
- Elasticsearch as database
- Jackson as data bind serialization/deserialization
- Java JWT for JWT implementation
- Jaxb for JWT parsing
- Slugify for slug
Tests:
- Junit
- Testcontainers to create an Elasticsearch instance
This is a multimodule gradle project:
- rw-database
- Elasticsearch client connection, queries, document classes
- rw-rest
- Spring rest controllers
- rw-server
- Configuration and entrypoint. Main class: SpringBootApp.java
A version of the JVM has to be installed, openjdk version "21.0.2" was used during development.
An Elasticsearch instance needs to be running for the application to start successfully. To start one easily, a docker-compose is provided, it will start Elasticsearch on port 9200 and Kibana on 5601; otherwise, the connection properties can be changed in application.properties.
./gradlew clean build
./gradlew run
The application will start on 8080 with api
context, it can be changed
in application.properties.
A basic unit test using testcontainer (docker is required).