Java SDK Overview
Quick Start
For a quick start check out the getting started section.
Why the SAP Cloud SDK for Java?
The SAP Cloud SDK for Java makes it easy to build highly connected, resilient, multi tenant SaaS applications on the SAP Business Technology Platform (SAP BTP). It enables you to perform outbound requests using various protocols while only writing the business logic.
For example, with the SAP Cloud SDK for Java you can connect to an SAP S/4HANA (Cloud) system via OData with only a few lines of code:
Destination destination = DestinationAccessor.getDestination("my-s4-system");
List<BusinessPartner> businessPartners = new DefaultBusinessPartnerService()
.getAllBusinessPartner()
.top(5)
.executeRequest(destination);
This example uses the pre-generated OData client together with the destination API to interact with the Business Partner Service of SAP S/4HANA Cloud.
The image below shows a typical architecture of an application built with the SAP Cloud SDK:
Main Features of the SAP Cloud SDK for Java
The SAP Cloud SDK for Java brings a wide variety of features to power your business application.
At its core, the SAP Cloud SDK for Java integrates the SAP BTP Destination and Connectivity services with powerful clients (e.g. OData) in a multi tenant and resilient manner. This integration reduces the code for typical outbound requests down to just a few statements.
The image below visualises the main components of the SAP Cloud SDK for Java.
Connectivity
The SAP Cloud SDK for Java provides an API that abstracts the details of establishing connections to other systems: The Destination API. This API makes it easy to connect to cloud and On-Premise systems with various authentication methods. Under the hood the SAP Cloud SDK handles all the necessary authorization and token flows that are necessary for the specific destination.
You can access destinations defined in the SAP BTP Cockpit directly in your code. Or you can define your own destinations, for example to connect to SAP BTP services.
You can then use these destinations to perform REST (OpenAPI or OData), RFC or SOAP requests. Or you can get a ready-made Http Client for a destination to execute your own requests.
OData and OpenAPI
The SAP Cloud SDK for Java also provides an easy and convenient type safe way to consume OData and OpenAPI services in your applications.
You can generate your own API client for OData or OpenAPI using the respective generators provided by the SAP Cloud SDK. You can also find detailed steps and a usage examples on the SAP Business Accelerator Hub.
Resilience
To ensure that applications can handle and recover from potential failures, the SAP Cloud SDK for Java provides abstractions for frequently used resilience patterns.
These patterns include caching, timeouts, retires, rate limiters, circuit breakers and bulkheads.
You can build a ResilienceConfiguration
to define which patterns you need and then use the ResilienceDecorator
to apply them to your operations.
For example, to configure a timeout of 100 ms for an operation:
TimeLimiterConfiguration timeLimiterConfig =
TimeLimiterConfiguration.of().timeoutDuration(Duration.ofMillis(100));
ResilienceConfiguration resilienceConfiguration =
ResilienceConfiguration.empty("my-resilience-config")
.timeLimiterConfiguration(timeLimiterConfig);
ResilienceDecorator.executeSupplier(() -> operation(), configuration);
You can find more details in our dedicated guide on Resilience.
Multitenancy
Multitenancy enables a single instance of an application to serve multiple technically separated user groups. To achieve this the SAP Cloud SDK for Java applies all its features in a tenant and user aware manner by default. For example, fetching a destination with the SAP Cloud SDK will fetch and cache it for the current tenant.
You can access the current tenant or user and other information via the dedicated accessors, for example TenantAccessor
and PrincipalAccessor
.
This enables you to run any code in a tenant aware manner.
This is achieved using the concept of ThreadContext
and you can read more about this on the dedicated guide on Multitenancy.
Further Information
Supported Platforms and Environments
The SAP Cloud SDK abstracts away from details of the underlying platform the application is running upon. This enables applications to adopt platform changes or fully switch to a different platform without any code changes.
Currently supported environments are :
- SAP BTP Cloud Foundry
- K8S , K8S with SAP Gardener
- SAP BTP Kyma
- Deploy with Confidence (For SAP internal customers only)
Supported Java Versions
The SAP Cloud SDK for Java runs with Java 17.
Supported Frameworks
The SAP Cloud SDK can be integrated into applications based on SAP Cloud Application Programming Model version 2.4.0
or higher, Spring 6 or Spring Boot 3.
Availability and Licensing
All libraries are available on Maven Central under the SAP Developer license. The license of clients generated with any of the SAP Cloud SDK code generators depends on the used service spec license.
Release Schedule
We usually release minor versions bi-weekly.
We intend to release a new major version of the SAP Cloud SDK for Java every twelve months. For details, check the release policy.
Support
The SAP Cloud SDK is actively supported via various internal and external channels which you can find here.