spring-boot-admin-docs/src/site/docs/09-samples/index.md
Spring Boot Admin includes several sample projects demonstrating different deployment scenarios and integration patterns. These samples provide working examples you can use as starting points for your own implementations.
All samples are available in the Spring Boot Admin GitHub repository:
spring-boot-admin-samples/
├── spring-boot-admin-sample-servlet/
├── spring-boot-admin-sample-reactive/
├── spring-boot-admin-sample-war/
├── spring-boot-admin-sample-eureka/
├── spring-boot-admin-sample-consul/
├── spring-boot-admin-sample-zookeeper/
├── spring-boot-admin-sample-hazelcast/
└── spring-boot-admin-sample-custom-ui/
git clone https://github.com/codecentric/spring-boot-admin.git
cd spring-boot-admin
mvn clean install -DskipTests
cd spring-boot-admin-samples/spring-boot-admin-sample-servlet
mvn spring-boot:run
Access the Admin UI at: http://localhost:8080
Most secured samples use:
userapplication.yml| Feature | Servlet | Reactive | Eureka | Consul | Zookeeper | Hazelcast | Custom UI | WAR |
|---|---|---|---|---|---|---|---|---|
| Web Stack | Servlet | WebFlux | Servlet | Servlet | Servlet | Servlet | Servlet | Servlet |
| Security | ✅ | ✅ | ✅ | ✅ | - | - | - | - |
| Service Discovery | Static | Static | Eureka | Consul | Zookeeper | Static | Static | Static |
| Clustering | - | - | - | - | - | ✅ | - | - |
| Custom UI | - | - | - | - | - | - | ✅ | - |
| JMX Support | ✅ | - | - | - | - | - | - | ✅ |
| Notifications | ✅ | - | - | - | - | - | - | - |
All samples share common patterns:
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
logging:
file:
name: "target/boot-admin-sample.log"
pattern:
file: "%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID}){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"
All samples generate build information:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
cd spring-boot-admin-samples/spring-boot-admin-sample-servlet
mvn spring-boot:run
Features:
# Start Eureka Server
docker run -d -p 8761:8761 springcloud/eureka
# Start Admin Server
cd spring-boot-admin-samples/spring-boot-admin-sample-eureka
mvn spring-boot:run
Features:
# Start multiple instances
cd spring-boot-admin-samples/spring-boot-admin-sample-hazelcast
# Terminal 1
SERVER_PORT=8080 mvn spring-boot:run
# Terminal 2
SERVER_PORT=8081 mvn spring-boot:run
Features:
Some samples include Docker Compose configurations:
cd spring-boot-admin-samples/spring-boot-admin-sample-eureka
docker-compose up
Use the samples as templates:
Copy sample directory:
cp -r spring-boot-admin-sample-servlet my-admin-server
Update pom.xml:
<artifactId>my-admin-server</artifactId>
<name>My Admin Server</name>
Customize configuration:
application.ymlBuild and run:
mvn clean package
java -jar target/my-admin-server.jar
Each sample includes tests:
cd spring-boot-admin-samples/spring-boot-admin-sample-servlet
mvn test
Change the port:
SERVER_PORT=9090 mvn spring-boot:run
Or in application.yml:
server:
port: 9090
Clean and rebuild:
mvn clean install -DskipTests
Update Spring Boot Admin version in parent POM and rebuild.
To add a new sample:
spring-boot-admin-samples/README.md with specific instructionsdocker-compose.yml if applicable