This document provides a comprehensive overview of the SAP Cloud SDK for Java, including its architecture, key subsystems, and developer interaction model. The SAP Cloud SDK for Java is a library that simplifies building cloud-native, multi-tenant SaaS applications on SAP Business Technology Platform (SAP BTP). It provides abstractions for connectivity, authentication, resilience, multi-tenancy, and code generation for OData and OpenAPI services.
This page covers the high-level architecture and design principles. For detailed information on specific subsystems:
The SAP Cloud SDK for Java is an open-source library (Apache 2.0 license) published to Maven Central that enables developers to build extensions and integrations for SAP products running on SAP BTP. The SDK abstracts the complexity of cloud platform services (authentication, destinations, multi-tenancy) and provides type-safe client generation for OData and OpenAPI services.
Sources: README.md23-28 pom.xml8-10
The SDK provides four major capability areas:
| Capability Area | Description | Key Modules |
|---|---|---|
| Connectivity | Abstractions for connecting to remote systems via HTTP, with built-in authentication, destination management, and OAuth2 flows | cloudplatform-connectivity, connectivity-destination-service, connectivity-oauth |
| Data Model Generation | Maven plugins that generate type-safe Java clients from OData metadata and OpenAPI specifications | odata-generator, odata-v4-generator, openapi-generator |
| Multi-Tenancy & Security | Thread-safe context management for tenant isolation, JWT authentication, and principal handling | cloudplatform-core, security, tenant |
| Resilience & Caching | Circuit breaker, retry, bulkhead, rate limiter, and time limiter patterns with tenant-aware caching | resilience, resilience4j, caching |
Sources: README.md30-59 dependency-bundles/modules-bom/pom.xml49-217
The repository follows a Maven multi-module structure with clear separation of concerns:
Maven Coordinates:
com.sap.cloud.sdksdk-parent5.26.0-SNAPSHOTSources: pom.xml1-38 dependency-bundles/bom/pom.xml1-10 dependency-bundles/modules-bom/pom.xml1-217
The SDK uses a three-tier Bill of Materials (BOM) approach to manage dependencies:
Key Characteristics:
sdk-bom: Imports external dependency BOMs (XSUAA, Service Binding) and declares versions for third-party libraries (SLF4J 2.0.17, Resilience4j 2.3.0, Caffeine 3.2.3)sdk-modules-bom: Declares versions for all SDK modules using the unified sdk.version propertysdk-core: Transitively includes connectivity, security, tenant, and resilience modules for simplified dependency managementSources: dependency-bundles/bom/pom.xml85-290 dependency-bundles/modules-bom/pom.xml49-217 pom.xml136-145
Developers interact with the SDK through three distinct phases:
Phase 1: Project Setup
spring-boot3 archetype to generate a Spring Boot application scaffolded with SDK dependenciespom.xml imports sdk-bom in dependencyManagement and declares specific module dependenciesPhase 2: Code Generation (Optional)
pom.xmlmvn generate-sources, plugins read API specifications and generate type-safe client codetarget/generated-sources and automatically added to the build classpathPhase 3: Runtime Development
BusinessPartnerService) use SDK connectivity abstractions under the hoodSources: README.md73-84 archetypes/pom.xml33-35
The SDK is organized into abstraction layers that separate concerns and allow flexible implementations:
Abstraction Benefits:
DestinationAccessor, TenantAccessor) hide implementation complexityDestinationLoader, DestinationRetrieval allow custom implementationsSources: pom.xml29-38 Module structure inferred from dependency-bundles/modules-bom/pom.xml
The SDK provides native integration with SAP BTP services through service binding discovery and OAuth2 flows:
Service Binding Discovery Flow:
ServiceBindingAccessor.getServiceBindings()DefaultServiceBindingAccessor reads from environment sources (VCAP_SERVICES, K8s secrets)DestinationServicePropertySupplier, XsuaaServicePropertySupplier) parse bindingsSupported BTP Services:
label: "destination"): Stores destination configurationslabel: "xsuaa"): OAuth2 token service for user and technical authenticationlabel: "identity"): IAS-based authenticationlabel: "connectivity"): On-premise connectivity proxylabel: "ztis"): Certificate-based mutual TLSSources: dependency-bundles/bom/pom.xml102-109 cloudplatform/connectivity-ztis/pom.xml49-59
The SDK enforces strict quality gates through Maven enforcer rules and static analysis:
Enforcer Rules (Validated on Every Build):
provided, logger bridges must be runtimeStatic Analysis Tools:
codestyle/checkstyle.xmlcodestyle/pmd.xml and codestyle/sdk_specific_pmd_rules.xmlcodestyle/spotbugs-exclusions.xmlBuild Lifecycle:
-Xlint:all warningsSources: pom.xml532-932 pom.xml54-77
The SDK publishes artifacts to Maven Central using a two-phase semi-automated release process:
Phase 1: Release Preparation (prepare-release workflow)
set-release-versions.pybuild-release-artifacts=true)Phase 2: Release Execution (perform-release workflow)
central-publishing-maven-pluginmain branchArtifact Types:
maven-source-plugin with -sources classifiermaven-javadoc-plugin with -javadoc classifier (delomboked sources)Distribution:
https://central.sonatype.com)https://common.repositories.cloud.sap/artifactory/build-snapshots-cloudsdk)Sources: dependency-bundles/bom/pom.xml29-38 dependency-bundles/bom/pom.xml292-487
The SDK follows semantic versioning (MAJOR.MINOR.PATCH) with maturity indicators:
Maturity Levels:
@Beta annotation@Deprecated annotationCurrent Version Structure:
-SNAPSHOT suffix for development versionsDependency Version Management:
sdk-bom (e.g., SLF4J 2.0.17, Resilience4j 2.3.0)sdk.version propertyCompatibility Policy:
Sources: pom.xml6 pom.xml50-52 dependency-bundles/bom/pom.xml44-83
Key dependency relationships between SDK modules:
| Module | Depends On | Purpose |
|---|---|---|
sdk-core | cloudplatform-connectivity, security, tenant, resilience4j | Convenience bundle for common dependencies |
odata-core | odata-client, cloudplatform-connectivity | OData v2 client runtime depends on connectivity layer |
odata-v4-core | odata-client, cloudplatform-connectivity | OData v4 client runtime depends on connectivity layer |
openapi-core | cloudplatform-connectivity, connectivity-apache-httpclient5 | OpenAPI client runtime uses HttpClient5 transport |
connectivity-destination-service | cloudplatform-connectivity, connectivity-oauth | Destination service depends on OAuth2 for token flows |
connectivity-apache-httpclient4 | cloudplatform-connectivity | HttpClient4 transport implements connectivity abstractions |
connectivity-apache-httpclient5 | cloudplatform-connectivity | HttpClient5 transport implements connectivity abstractions |
resilience4j | resilience-api, cloudplatform-core | Resilience4j implementation depends on API abstractions |
security | cloudplatform-core | Security components use ThreadContext from core |
tenant | cloudplatform-core | Tenant components use ThreadContext from core |
Core Dependencies (Required by Most Modules):
slf4j-api (2.0.17): Logging facadevavr (0.11.0): Functional data structures (Try, Either, Option)jsr305 (3.0.2): Nullability annotations (@Nonnull, @Nullable)Sources: dependency-bundles/modules-bom/pom.xml49-217 datamodel/openapi/openapi-core/pom.xml34-108
The SDK provides Maven plugins that generate type-safe clients during the build:
Generation Process:
NamingContext converts API names to valid Java identifiersPojoCodeGenerator generates POJOs, ServiceClassGenerator generates service APIsMetadataGenerator creates VDM metadata for runtime introspectiontarget/generated-sources/javaGenerated Code Characteristics:
.select(), .filter(), .top())Sources: datamodel/openapi/openapi-generator/pom.xml1-194 pom.xml520-528
The SAP Cloud SDK for Java provides a comprehensive framework for building cloud-native applications on SAP BTP. Its architecture separates concerns into layers (connectivity, data models, cross-cutting concerns), uses interface-based abstractions to allow customization, and provides code generation to eliminate boilerplate. The SDK's Maven-based structure, strict quality gates, and integration with BTP services make it suitable for enterprise-grade development.
For detailed information on specific subsystems, refer to the linked wiki pages at the beginning of this document.
Refresh this wiki
This wiki was recently refreshed. Please wait 7 days to refresh again.