Spring Boot Deployment and Usage Guide
Prerequisites
- Java Development Kit (JDK) 17 or 21 (Spring Boot 3.x requires Java 17 as a baseline)
- Apache Maven 3.9.0+ (or use the provided Maven Wrapper
./mvnw) - Git 2.20+
- Docker (optional, required for integration tests with Kafka, Redis, and other external services)
- System Resources: Minimum 4GB RAM available for the build process (8GB recommended)
Installation
Clone the repository and checkout the desired branch:
git clone https://github.com/spring-projects/spring-boot.git
cd spring-boot
git checkout main # or specific version tag (e.g., v3.2.0)
Verify your environment:
./mvnw -version
Configuration
Maven Memory Settings
Set environment variables to prevent OutOfMemoryError during builds:
export MAVEN_OPTS="-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError"
Or create .mvn/jvm.config in the project root:
-Xmx2g
-XX:MaxMetaspaceSize=512m
Integration Test Configuration
For Kafka integration tests (as seen in KafkaProperties.java), configure external services via environment variables:
export SPRING_KAFKA_BOOTSTRAP_SERVERS=localhost:9092
Or rely on Testcontainers (requires Docker running) which auto-starts Kafka, Redis, and other services during tests.
Proxy Settings (Corporate Environments)
Configure ~/.m2/settings.xml for proxy access:
<settings>
<proxies>
<proxy>
<id>corporate-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.company.com</host>
<port>8080</port>
</proxy>
</proxies>
</settings>
Build & Run
Full Build
Build the entire framework including tests:
./mvnw clean install
Quick Build (Development)
Skip tests and checks for faster iteration:
./mvnw clean install -DskipTests -Dcheckstyle.skip -T 4
Build Specific Modules
Build only the core module and its dependencies:
./mvnw clean install -pl spring-boot-project/spring-boot -am
Run Sample Applications
Navigate to a sample project and run:
cd spring-boot-samples/spring-boot-sample-simple
../../mvnw spring-boot:run
Or build and run the JAR:
../../mvnw clean package
java -jar target/spring-boot-sample-simple-*.jar
Running Tests
Run unit tests only (skips integration tests requiring Docker):
./mvnw test -Dtest=!*IntegrationTests
Run specific integration tests:
./mvnw test -pl spring-boot-project/spring-boot-autoconfigure -Dtest=KafkaAutoConfigurationTests
Deployment
Local Maven Repository
After mvn install, artifacts are available in ~/.m2/repository/org/springframework/boot/. Use them in your projects by referencing the SNAPSHOT version:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.0-SNAPSHOT</version>
</parent>
Deploying Applications Built with Spring Boot
Package your application as an executable JAR:
./mvnw clean package spring-boot:repackage
java -jar target/myapp.jar
Or deploy to cloud platforms:
- Cloud Foundry:
cf push myapp -p target/myapp.jar - Kubernetes: Use the Jib Maven plugin or build a container image:
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=myapp:latest
Contributing Changes
- Build locally:
./mvnw clean install - Verify code style:
./mvnw checkstyle:check - Run full integration tests:
./mvnw verify -Pit - Commit and push to your fork
Troubleshooting
OutOfMemoryError During Build
Increase heap space:
export MAVEN_OPTS="-Xmx4g -XX:MaxMetaspaceSize=1g"
Test Failures: "Connection Refused"
Ensure Docker is running for integration tests using Testcontainers. Alternatively, skip integration tests:
./mvnw install -DskipITs
Checkstyle Violations
Auto-format code before committing:
./mvnw spring-javaformat:apply
Port Conflicts in Tests
If ports 8080, 9092 (Kafka), or 6379 (Redis) are occupied, tests using Testcontainers will use random ports, but specific tests may fail. Set custom ports:
export SPRING_KAFKA_BOOTSTRAP_SERVERS=localhost:9093
Slow Builds
Enable parallel builds and skip non-essential checks:
./mvnw clean install -T 4 -DskipTests -Dcheckstyle.skip -Denforcer.skip
Dependency Resolution Issues
Force update of snapshots:
./mvnw clean install -U