Version 4 of the SAP Cloud SDK for Java is Here
Today, we have released version 4.0.0 of the SAP Cloud SDK for Java. After three years since the release of version 3 and well over 70 minor version updates since then, this is the next major version of the SDK. It brings many improvements and new features while keeping most of the API stable to make updating as seamless as possible.
In this blog post, I want to share what is new, what has changed and how you can get started with the new version. For the technical details on how to update, please head to this dedicated guide.
So, what’s new? With version 4 our goal is to make the SDK easier to use, more lightweight and better integrated. At the same time, updating an existing project that uses the SAP Cloud SDK should be as easy and effortless as possible.
Keeping that in mind, let’s look at which improvements version 4 is bringing to your projects.
Easier Dependency Management
We reduced the amount of transitive dependencies the Cloud SDK brings into projects. By reducing the dependency footprint the SDK gets more light-weight, is easier to use with other frameworks like CAP and dependency conflicts become less likely. You can check the full list of removed dependencies here.
For customers using a Tomcat or TomEE container with the SAP Java Buildpack we also introduced a completely new BOM, dedicated to the SAP Java Buildpack. The BOM ensures all relevant dependencies have their version and scope set to be compatible with the Buildpack.
New ThreadContext and Thread Handling
The Cloud SDK uses a context object called ThreadContext to store the current tenant, user and other related information.
With version 4 this feature has received major changes:
- We introduced a completely new API for running asynchronous tasks with the SDK
- The ThreadContext can now conveniently be used with Spring’s @Async feature
- Asynchronous tasks are no longer bound to the lifecycle of the thread that scheduled them
- The Cloud SDK now better integrates with CAP Framework and the Security Library
- The APIs now bring more clarity and the underlying implementation is more robust
Here is an example of how you can obtain a destination asynchronously while preserving all tenant and user information:
Future<Destination> destinationFuture = ThreadContextExecutors.submit( () -> DestinationAccessor.getDestination("my-destination"));
Make sure to check out all the details of these features on the full documentation.
Better Integration with Kubernetes Environments
Starting with version 4.0.0 the SAP Cloud SDK leverages a new library under the hood to access service bindings. With the new library all versions of the SAP BTP Service Operator are now supported. In particular this also means that the Kyma platform is now supported out of the box (except for on-premise connectivity).
Removal of Deprecated API
We not only added new functionality but also removed a lot of long deprecated API. Most notably we removed the dependency to the legacy SDK for Service Development (Service SDK), together with all API related to it. This completes the transition to our own OData client.
Among other deprecated APIs we also removed a substantial amount of legacy modules which were no longer used and only existed for compatibility. All of these changes helped sliming down the SDK and reducing the dependency footprint. Head over to the documentation for a full list of removed API and modules.
How to Update?
Good news: Updating is easy! Chances are you can update without significant code changes. Still, we compiled a detailed guide to help you update your existing projects.
To test the process we worked with a number of customers and were able to update their projects with either minimal or no code changes at all.
How long will Version 3 be Supported?
Don’t worry, in case you can’t update right away you can continue using version 3. It will continue to receive critical security patches.
However, new features and improvements will only be shipped to version 4. You can read more about the release strategy and support here.
With version 4 we bring even more features, better integration and easier usage to the SAP Cloud SDK. All of which while keeping API changes to a minimum for a seamless upgrade experience. So get started with version 4 of the SAP Cloud SDK for Java or update your current project with the detailed update guide.
Share Your Feedback
Do you have any questions on the new features? Or are you struggling with the upgrade? Don’t hesitate to share your feedback in the comments below, ask a question in the Q&A or to create a dedicated issue on our GitHub.