{"id":19336533,"url":"https://github.com/spt-development/spt-development-demo","last_synced_at":"2026-05-09T05:03:39.921Z","repository":{"id":39925572,"uuid":"402179501","full_name":"spt-development/spt-development-demo","owner":"spt-development","description":"Demonstrates the use of a number of the spt-development projects related to logging and auditing.","archived":false,"fork":false,"pushed_at":"2025-05-24T17:29:44.000Z","size":322,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-24T18:27:39.017Z","etag":null,"topics":["auditing","logging","microservices","spring-boot","spring-jms","spring-mvc"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spt-development.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-09-01T19:27:58.000Z","updated_at":"2025-05-24T17:29:44.000Z","dependencies_parsed_at":"2025-05-04T17:22:20.404Z","dependency_job_id":"7d00397e-abd8-4e06-ad57-f35d3555db6c","html_url":"https://github.com/spt-development/spt-development-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/spt-development/spt-development-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Fspt-development-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Fspt-development-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Fspt-development-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Fspt-development-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spt-development","download_url":"https://codeload.github.com/spt-development/spt-development-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Fspt-development-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32807861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auditing","logging","microservices","spring-boot","spring-jms","spring-mvc"],"created_at":"2024-11-10T03:11:34.104Z","updated_at":"2026-05-09T05:03:39.908Z","avatar_url":"https://github.com/spt-development.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"````\n  ____  ____ _____   ____                 _                                  _   \n / ___||  _ \\_   _| |  _ \\  _____   _____| | ___  _ __  _ __ ___   ___ _ __ | |_ \n \\___ \\| |_) || |   | | | |/ _ \\ \\ / / _ \\ |/ _ \\| '_ \\| '_ ` _ \\ / _ \\ '_ \\| __|\n  ___) |  __/ | |   | |_| |  __/\\ V /  __/ | (_) | |_) | | | | | |  __/ | | | |_ \n |____/|_|    |_|   |____/ \\___| \\_/ \\___|_|\\___/| .__/|_| |_| |_|\\___|_| |_|\\__|\n                                                 |_|                                           \n demo----------------------------------------------------------------------------\n````\n\n[![build_status](https://github.com/spt-development/spt-development-demo/actions/workflows/build.yml/badge.svg)](https://github.com/spt-development/spt-development-demo/actions)\n\nA simple demo project demonstrating how to integrate the following open source projects into a Spring Boot application,\nthrough the use of the corresponding Spring Boot starters.\n\n* [spt-development/spt-development-audit-spring](https://github.com/spt-development/spt-development-audit-spring)\n* [spt-development/spt-development-cid-jms-spring](https://github.com/spt-development/spt-development-cid-jms-spring)\n* [spt-development/spt-development-cid-web](https://github.com/spt-development/spt-development-cid-web)\n* [spt-development/spt-development-logging-spring](https://github.com/spt-development/spt-development-logging-spring)\n\nThe project provides a simple 'books' REST API backed by a postgres database (see below), that shows how the use of these \nprojects can be used to quickly and easily add production grade logging to your Spring Boot projects. The project also \nintegrates [spt-development/spt-development-audit-spring](https://github.com/spt-development/spt-development-audit-spring)\ndemonstrating how to use simple annotations to capture audit information. The auditing is configured to use the \nrecommended approach of writing the audit records to a JMS queue and processing them asynchronously.\n\nBuilding locally\n================\n\nTo build the project and run the integration tests, run the following Maven command:\n\n```shell\n$ ./mvnw clean install\n```\n\nThe integration tests use [Testcontainers](https://www.testcontainers.org/) therefore docker must be installed on the\nmachine the build is run on.\n\n**NOTE** To update `mvnw` run `mvn wrapper:wrapper`.\n\nRunning the demo\n================\n\nThe best way to understand how things are working is to run and debug the integration tests in your favourite IDE. However, \nto run the demo project from the command line, the easiest way is to use the Spring Boot plugin (the project currently requires\nJDK 17 or above).\n\n```shell\n$ ./mvnw spring-boot:run\n```\n\nThis will also use the [docker-compose.yml](./docker-compose.yml) file to start up postgres and ActiveMQ in docker containers\nthrough the use of Spring Boot's \n[docker compose support](https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.docker-compose).\n\nAlternatively, and more akin to how you would run the application in production, you can run the application with java overriding\nthe `spring.datasource.*`, `spring.activemq.*` and `*.otlp.` properties to point at an already running Postgres database, \nActiveMQ instance and OpenTelemety endpoint respectively. The example below does this through the use of environment variables to\npoint at a Postgres database etc, running in Docker.\n\n```shell\n$ SPRING_DATASOURCE_URL=jdbc:postgresql://127.0.0.1:5432/spt-development-demo \\\n  SPRING_DATASOURCE_USERNAME=postgres \\\n  SPRING_DATASOURCE_PASSWORD=p@ssw0rd \\\n  SPRING_ACTIVEMQ_BROKER_URL=tcp://localhost:61616 \\\n  MANAGEMENT_OTLP_METRICS_EXPORT_URL=http://localhost:4318/v1/metrics \\\n  OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://localhost:4318/v1/logs \\\n  OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics \\\n  OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4318/v1/traces \\\n  java -jar target/spt-development-demo-0.0.1-SNAPSHOT.jar \n```\n\nOnce the application is running, the REST API can then be exercised with cURL as follows:\n\n```shell\n$ curl -v -u bob:password123! --header \"Content-Type: application/json\" \\\n    --request POST \\\n    --data '{\"title\":\"My Book\",\"blurb\":\"My blurb\",\"author\":\"Me\",\"rrp\":1000}' \\\n    http://localhost:8080/api/v1.0/books\n```\n```shell\n$ curl -v -u bob:password123! --header \"Content-Type: application/json\" \\\n    --request PUT \\\n    --data '{\"id\":4, \"title\":\"My Book - updated\",\"blurb\":\"My blurb - updated\",\"author\":\"Me\",\"rrp\":1000}' \\\n    http://localhost:8080/api/v1.0/books/4\n```\n```shell\n$ curl -v -u bob:password123! http://localhost:8080/api/v1.0/books\n```\n```shell\n$ curl -v -u bob:password123! http://localhost:8080/api/v1.0/books/4\n```\n```shell\n$ curl -v -u bob:password123! -X DELETE http://localhost:8080/api/v1.0/books/4\n```\nAdditionally, the Actuator web endpoints have been enabled on port 8081 and can be accessed unauthorized. For example:\n\n```shell\n$ curl -v http://localhost:8081/actuator/health\n```\nor\n```shell\n$ curl -v http://localhost:8081/actuator/info\n```\n\nRunning the demo in docker\n==========================\n\nThere are multiple ways to [build a docker image](https://www.baeldung.com/spring-boot-docker-images) for Spring Boot \napplications. The simplest way is to use Buildpacks.\n\n```shell\n$ ./mvnw spring-boot:build-image\n```\nThe [docker-compose.service.yml](./docker-compose.service.yml) can then be used to run the image along with \n[docker-compose.yml](./docker-compose.yml) to start up Postgres and ActiveMQ.\n\n```shell\n$ docker compose -f docker-compose.yml -f docker-compose.service.yml up -d\n```\nThe cURL commands above can again be used to test the API.\n\nGrafana\n-------\n\nSpring Boot 3.4.0 extended the Docker Compose support to support \n[Grafana LGTM](https://grafana.com/blog/2024/03/13/an-opentelemetry-backend-in-a-docker-image-introducing-grafana/otel-lgtm/).\n\nThis project's Docker Compose files have been updated to include Grafana LGTM and whether running the demo with the Spring Boot\nMaven plugin or with Docker Compose, Grafana can be accessed [here](http://localhost:3000/). The application will send metrics,\nlogs and traces to Grafana which has been provisioned with the following dashboards for visualising this data:\n\n* JVM Overview\n* RED Metrics\n* Spring Boot 3.x Statistics\n* Spring Boot Observability\n\n**NOTE** As stated on the Grafana LGTM page, Grafana LGTM is not production ready and \"is an open source backend for OpenTelemetry\nthat’s intended for development, demo, and testing environments.\"","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspt-development%2Fspt-development-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspt-development%2Fspt-development-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspt-development%2Fspt-development-demo/lists"}