Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '21'
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
Expand Down
2 changes: 1 addition & 1 deletion .idea/runConfigurations/SpringBootOpenapiApplication.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
Spring batch samples
k8s samples
start multiple boot processes (supervisord rewrite in spring boot )
actuator sanitanization library
HTML/ASCII doc/yaml schema generator
HTML/ASCII doc generator
Multiple datasources sample
rabbitmq sample
redis sample
config server static file download
http/tcp configurable health check
k8s scaling sample
web page
decide one domain
6 changes: 6 additions & 0 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: extensions
title: Actuator extensions
version: 1.0.0
nav:
- modules/ROOT/nav.adoc

1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* xref:index.adoc[Spring boot examples]
187 changes: 187 additions & 0 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
= Spring Boot Playground Modules
:toc: left
:sectnums:

This project is a multi-module Spring Boot playground showcasing REST APIs, configuration, security, OpenAPI, JPA + Flyway, Thymeleaf MVC, Admin monitoring, and AI integrations.

== Module Map

- spring-boot-rest-sample — REST API basics
- spring-boot-config-sample — Externalized configuration patterns
- spring-boot-admin-server — Admin UI for monitoring apps
- spring-boot-config-server — Centralized configuration service
- spring-boot-data-jpa-flyway — Persistence + migrations
- spring-boot-openapi-root — Parent for OpenAPI samples
- spring-boot-thymeleaf — Server-side MVC with Thymeleaf
- spring-boot-security-root — Parent for security samples
- spring-boot-security-basic — Basic auth demo
- spring-boot-security-jwt — JWT-based security demo
- spring-boot-ai-samples — Spring AI integrations
- openapi-sample (under spring-boot-openapi-root) — Concrete OpenAPI demo

== spring-boot-rest-sample

A reference REST service demonstrating:
- CRUD endpoints with JSON payloads
- Bean validation and error handling
- Controller advice for exceptions
- Meaningful HTTP status codes

How to run:
- mvn spring-boot:run
- Explore endpoints under /api

Learning goals:
- Build clean REST controllers
- Structure DTOs/validation
- Centralize error responses

== spring-boot-config-sample

Externalized configuration patterns:
- application.yaml + profiles
- @ConfigurationProperties with validation
- Metadata via configuration processor

How to run:
- Use -Dspring.profiles.active=dev|prod to switch environments

Learning goals:
- Safe, typed configuration binding
- Profile-specific settings
- Documenting configuration

== spring-boot-admin-server

Admin console to monitor Spring Boot apps:
- Health, metrics, environment, logs
- JVM info and endpoints overview

How to run:
- Start this server, then register client apps with admin client starter

Learning goals:
- Observability with minimal setup
- Operational visibility for teams

== spring-boot-config-server

Centralized configuration with Spring Cloud Config:
- Git-backed properties
- Environment-specific files
- Encryption/decryption support

How to run:
- Point spring.cloud.config.server.git.uri to a repo
- Clients fetch configuration at bootstrap

Learning goals:
- Central config management
- Safe secret handling and refresh

== spring-boot-data-jpa-flyway

Persistence + migrations:
- Spring Data JPA repositories
- Transactions and entity mapping
- Flyway versioned migrations

How to run:
- mvn spring-boot:run (Flyway runs at startup)

Learning goals:
- Reliable schema evolution
- Clean repository design
- Testing data layers

== spring-boot-openapi-root

Parent for OpenAPI samples providing:
- Dependency and plugin alignment
- Shared conventions for documentation

Learning goals:
- Organizing API documentation across modules

=== openapi-sample

Concrete OpenAPI demo:
- springdoc-openapi integration
- Swagger UI
- Schemas and validation annotations

How to run:
- mvn spring-boot:run
- Visit /swagger-ui.html

Learning goals:
- API-first documentation
- Accurate schemas and examples

== spring-boot-thymeleaf

Server-side MVC with Thymeleaf:
- Templates, fragments, and layouts
- Form binding and validation
- I18n support

How to run:
- mvn spring-boot:run
- Visit web UI routes

Learning goals:
- Productive SSR development
- Clean template composition

== spring-boot-security-root

Parent for security samples:
- Baseline dependencies
- Shared configuration practices

Learning goals:
- Consistent security setup across modules

=== spring-boot-security-basic

Basic authentication:
- In-memory users/roles
- Form login and protected routes

How to run:
- mvn spring-boot:run
- Access a protected endpoint to see login flow

Learning goals:
- Security filter chain basics
- Method and URL-based authorization

=== spring-boot-security-jwt

JWT-based security:
- Token issuance/validation
- Stateless sessions
- Role-based access

How to run:
- Obtain token via auth endpoint
- Call protected APIs with Authorization: Bearer <token>

Learning goals:
- API security at scale
- Token lifecycle and best practices

== spring-boot-ai-samples

AI integrations with Spring AI:
- Chat/completions flows
- Prompt engineering patterns
- Retry and observability

How to run:
- Configure AI provider credentials via env/properties
- mvn spring-boot:run

Learning goals:
- Safely integrate AI services
- Reusable abstractions for AI features
18 changes: 18 additions & 0 deletions docs/modules/ROOT/partials/_hconfigprops.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.Configuration Properties
|===
|Name |Default Value |Description

|management.health.actuator.sites
|{}
|Map of site configurations where key is site identifier and value contains site-specific settings for actuator health checks.

|management.health.http.sites
|{}
|Map of site configurations where key is site identifier and value contains site-specific settings for HTTP health checks.

|management.health.port.sites
|{}
|Map of site configurations where key is site identifier and value contains port availability check settings.

|===

28 changes: 28 additions & 0 deletions docs/modules/ROOT/partials/_sconfigprops.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.Configuration Properties
|===
|Name |Default Value |Description

|management.endpoint.sanitizing.enabled
|`true`
|Whether to enable custom sanitization (if false, uses Spring Boot defaults).

|management.endpoint.sanitizing.key-patterns
|`[".*password.*", ".*secret.*", ".*token.*", ".*key.*", ".*credential.*"]`
|List of regex patterns to match property keys for sanitization.

|management.endpoint.sanitizing.keys
|`["password", "secret", "token", "key", "credential", "private"]`
|List of exact property keys to sanitize (case-insensitive).

|management.endpoint.sanitizing.mask-value
|`\******`
|The masked value to show instead of the actual value.

|management.endpoint.sanitizing.sanitize-values
|`true`
|Whether to sanitize values.

|management.endpoint.sanitizing.value-patterns
|`["^[A-Za-z0-9+/=]{20,}$", "^[A-Fa-f0-9]{32,}$", "^Bearer .*", "^Basic .*"]`
|List of regex patterns to match values for sanitization. Includes patterns for Base64-encoded strings (20+ chars), hex-encoded hashes/keys (32+ chars), and common Authorization headers (Bearer, Basic).
|===
19 changes: 17 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,33 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.3</version>
<version>3.5.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<spring-boot-admin.version>3.2.3</spring-boot-admin.version>
<spring-boot-admin.version>3.5.5</spring-boot-admin.version>
<spring-cloud.version>2025.0.0</spring-cloud.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>spring-boot-rest-sample</module>
<module>spring-boot-config-sample</module>
<module>spring-boot-admin-server</module>
<module>spring-boot-config-server</module>
<module>spring-boot-data-jpa-flyway</module>
<module>spring-boot-openapi-root</module>
<module>spring-boot-thymeleaf</module>
<module>spring-boot-security-root</module>
<module>spring-boot-ai-samples</module>
</modules>
</project>
2 changes: 1 addition & 1 deletion refrenece/openapi/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<manifest package="org.openapitools.client" xmlns:android="http://schemas.android.com/apk/res/android">
<manifest package="org.openapitools.client">
<application />
</manifest>
76 changes: 76 additions & 0 deletions spring-boot-admin-server/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.alexmond</groupId>
<artifactId>boot-sample-root</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>spring-boot-admin-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Spring Boot Admin Server</name>
<description>Admin UI for monitoring Spring Boot apps: health, metrics, logs, environment, and JVM details. Useful for local demos and production-ready observability patterns.</description>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Alex Mondshain</name>
<email>alex.mondshain@gmail.com</email>
</developer>
</developers>
<properties>
<java.version>17</java.version>
<spring-cloud.version>2025.0.0</spring-cloud.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Loading