Sample Projects
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.
Available Samples
Basic Deployments
- Servlet Sample - Traditional servlet-based deployment with security
- Reactive Sample - WebFlux reactive deployment
Service Discovery
- Eureka Sample - Netflix Eureka integration
- Consul Sample - HashiCorp Consul integration
- Zookeeper Sample - Apache Zookeeper integration
Advanced
- Hazelcast Sample - Clustered deployment with Hazelcast
- Custom UI Sample - Custom UI extensions and branding
Repository Location
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/
Running the Samples
Prerequisites
- Java 17 or higher
- Maven 3.6 or higher
- Docker (optional, for some samples)
Build All Samples
git clone https://github.com/codecentric/spring-boot-admin.git
cd spring-boot-admin
mvn clean install -DskipTests
Run Individual Sample
cd spring-boot-admin-samples/spring-boot-admin-sample-servlet
mvn spring-boot:run
Access the Admin UI at: http://localhost:8080
Default Credentials
Most secured samples use:
- Username:
user - Password: Check console output or
application.yml
Sample Features Comparison
| 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 | ✅ | - | - | - | - | - | - | - |
Common Configuration
All samples share common patterns:
Actuator Configuration
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
Logging Configuration
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"
Build Info
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>
Quick Start Guide
1. Servlet Sample (Recommended for Beginners)
cd spring-boot-admin-samples/spring-boot-admin-sample-servlet
mvn spring-boot:run
Features:
- Security enabled
- Self-monitoring
- Mail notifications
- Custom UI extensions
2. Eureka Sample (Recommended for Microservices)
# 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:
- Automatic service discovery
- Dynamic registration
- No client library needed
3. Hazelcast Sample (Recommended for Production)
# 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:
- High availability
- Shared event store
- Load balancing ready
Docker Support
Some samples include Docker Compose configurations:
cd spring-boot-admin-samples/spring-boot-admin-sample-eureka
docker-compose up
Customizing Samples
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:
- Update
application.yml - Add security configuration
- Configure notifications
- Update
-
Build and run:
mvn clean package
java -jar target/my-admin-server.jar
Testing Samples
Each sample includes tests:
cd spring-boot-admin-samples/spring-boot-admin-sample-servlet
mvn test
Troubleshooting Samples
Port Already in Use
Change the port:
SERVER_PORT=9090 mvn spring-boot:run
Or in application.yml:
server:
port: 9090
Build Failures
Clean and rebuild:
mvn clean install -DskipTests
Dependencies Issues
Update Spring Boot Admin version in parent POM and rebuild.
Contributing
To add a new sample:
- Create directory under
spring-boot-admin-samples/ - Follow existing sample structure
- Add
README.mdwith specific instructions - Include
docker-compose.ymlif applicable - Add tests
- Update samples documentation
See Also
- Getting Started - Basic setup guide
- Server Configuration - Server configuration options
- Integration - Service discovery integration
- Customization - UI and server customization