Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Junjie
Advisor
Advisor
The SAP Cloud SDK for Java has recently launched its latest major version (v5) on Maven Central.

In this blog post, we'll explore the key values and improvements that will assist in planning your upgrade to SDK version 5.

Open Source Migration


One of the key highlights of SAP Cloud SDK for Java 5 is its commitment to open source migration. (repo)

Historically, the SAP Cloud SDK for JavaScript (repo) has been open sourced since 2020 with very positive experience and feedback. Over the years, the community has asked for the second open source migration of the Java variant. Now, this is the answer from the team.

This move not only enhances transparency but also invites developers to actively contribute to the SDK's evolution. By opening up the source code, the SDK becomes a truly community-driven project, allowing developers to play a direct role in shaping the future of the SDK.

Please contact us via the GitHub issues (link) for questions, bug fixes, or feature requests.

If you want to contribute to the SDK, please check our contribution guidelines.

Support: Java 17, Spring 6 and Spring Boot 3


The SAP Cloud SDK for Java version 5 brings native support for the modern versions in the Java ecosystem, including Java 17, Spring 6, and Spring Boot 3. This ensures that developers can leverage the full potential of Java/Spring, taking advantage of the latest features and improvements for optimising application development.

The SAP Cloud SDK for Java is used by CAP (SAP Cloud Application Programming Model). As CAP version 2 needs Java 17 & Spring Boot 3 as minimal versions, you will gain the best user experience, when upgrading to SDK version 5 together with CAP 2.

For users who have already tried our experimental feature of the Java 17 support in SDK v4, potential workarounds are no longer needed.

Check our upgrade guide for more details.

Support: Apache HttpClient 5


In SDK version 4, the experimental feature introduced the use of Apache HttpClient v5. Now, as an official feature, developers can confidently benefit from robust APIs.

You can find a minimal code example for using the HttpClient v5:
Destination destination = DestinationAccessor.getDestination("my-destination");
HttpClient client = ApacheHttpClient5Accessor.getHttpClient(destination);

To compare the usage of the HttpClient v4, here is another example for the v4:
Destination destination = DestinationAccessor.getDestination("my-destination");
HttpClient client = HttpClientAccessor.getHttpClient(destination);

The complete documentation about the HttpClient v5 feature can be found here.

Improved Module Structure


Thanks to the new platform agnostic maven module structure, as a user, you only need to add the essential dependency (com.sap.cloud.sdk:sdk-core) for most of the use cases, instead of "scp-cf" or "scp-neo" for dedicated platforms. As a result, your SDK related maven dependency tree should be cleaner and smaller.

In addition to that, users will also benefit from a simplified, more powerful, and more extensible connectivity API. For example, you can build a destination from destination properties, a map, or another destination:
DefaultHttpDestination.fromProperties(myDestinationProperties)
DefaultHttpDestination.fromMap(myMap)
DefaultHttpDestination.fromDestination(myDestination)

You can conveniently modify properties form an existing instance by using "toBuilder":
myHttpDestination.toBuilder()

Check our release notes for more details.

Lastly, as a side note, SDK version 5 also provides complete support for the DwC (Deploy with Confidence) Orbits architecture. Check the DwC documentation for more details.

Recommendation


We strongly recommend upgrading your SAP Cloud SDK for Java dependency to version 5 at your earliest convenience, as it introduces significant improvements and new capabilities. Although SDK v4 will remain in maintenance mode for another six months, active development has shifted to SDK v5.

If you have any questions during the upgrading, please open an issue here.