Spring Cloud compatibility
What you will learn
Spring Cloud groups distributed-system libraries into a release train. Use a compatible Spring Boot baseline and import the train BOM so component versions are coordinated. A compatible version declaration is not evidence that a service is correctly configured or resilient.
- Select a compatible Boot and Cloud release train.
- Explain Gateway, Config, CircuitBreaker and Stream responsibilities.
- Plan a local integration test without remote service registration.
Plain Java examples: save as Main.java in a fresh directory, then run javac --release 21 Main.java and java Main. Standalone Java 21 models; the companion Spring Cloud configuration is source-reviewed, not executed.
Select a documented train family
public class Main { static String train(String boot) { if(boot.matches("4\\.[01]\\.\\d+")) return "2025.1.5"; return "review matrix"; } public static void main(String[] args) { System.out.println(train("4.0.10")); System.out.println(train("3.5.0")); }}Expected output:
2025.1.5review matrixThis deliberately narrow model recognizes stable Boot 4.0/4.1 versions for one documented train. It is not a complete dependency resolver or support checker.
Version selection and BOM
The Spring release announcement dated November 20, 2026 identifies Cloud 2025.1.5 as compatible with Boot 4.0.x and 4.1.x. This course keeps Boot 4.0.10 from previous chapters, and imports org.springframework.cloud:spring-cloud-dependencies:2025.1.5 with type pom and scope import in dependencyManagement. A BOM aligns managed versions but does not add dependencies. Choose the appropriate starter explicitly. Review the exact version matrix, dependency tree, release notes and support policy before deploying. Compatibility is documented at the train level; the pair is not executed here.
Components and boundaries
Gateway routes requests and may enforce edge policies; downstream services still authorize access to their own resources. Config supplies externalized settings; use trusted, authenticated sources and avoid plaintext secrets in Git. Discovery and LoadBalancer select service instances from a configured registry or platform; they do not guarantee availability. CircuitBreaker supplies an abstraction over resilience implementations; configure failure thresholds, time limits and bulkheads with care. Stream connects application functions to messaging binders; delivery and transactional semantics still depend on the broker and application. Propagate trace context across boundaries, and measure actual failures before tuning.
Local integration plan
The companion POM imports the train BOM and adds the Gateway WebFlux starter. A loopback-only YAML route points to a fictional inventory endpoint. It is configuration for a learner-operated local lab, not launched or registered automatically. Use two test-owned mock endpoints, verify routing, bounded timeouts, error responses and unavailable upstreams. Test unauthorized access at the service too. Verify the effective POM and dependency tree with Maven before running. Do not disable compatibility verification to force mismatched versions.
Map configuration with an explicit override
public class Main { static int timeout(java.util.Map<String,String> config) { int ms=Integer.parseInt(config.getOrDefault("timeoutMs","500")); if(ms<1 || ms>2000) throw new IllegalArgumentException("timeout"); return ms; } public static void main(String[] args) { var config=java.util.Map.of("timeoutMs","300"); System.out.println(timeout(config)); System.out.println(timeout(java.util.Map.of())); }}Expected output:
300500The model demonstrates safe bounded configuration. It does not reproduce the Spring Environment property precedence rules.
Prevent a fallback from inventing success
public class Main { static String fallback(boolean cachedReadAvailable) { return cachedReadAvailable ? "stale read; age required" : "unavailable"; } public static void main(String[] args) { System.out.println(fallback(false)); System.out.println(fallback(true)); }}Expected output:
unavailablestale read; age requiredA stale read must be identified and bounded by an age policy. A write fallback cannot assert that the remote effect happened.
Common mistakes
Do not import a random train or mix arbitrary individual Spring Cloud versions. A gateway is not a substitute for resource authorization. Do not send real credentials or register services in this lab.
Practice
Write a policy that accepts a positive per-attempt timeout no greater than the overall remaining budget. Print true for 100/120, false for 130/120 and false for 0/120.
Expected output:
truefalsefalseCompare with the manual review criteria.
Further reading: Cloud · Train · Compatibility. Independent editorial review remains pending.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Spring Cloud compatibility — knowledge check
Distributed systems and resilience reasoning.
Which BOM is documented for the chosen Boot 4.0.x baseline?
What does dependencyManagement import do?
What does Gateway primarily do?
What does Spring Cloud Stream connect?
What is the status of the companion Cloud config?