diff --git a/docs-java_versioned_docs/version-v5/environments/gardener.mdx b/docs-java_versioned_docs/version-v5/environments/gardener.mdx index 09549b2af87..8a3fa68b285 100644 --- a/docs-java_versioned_docs/version-v5/environments/gardener.mdx +++ b/docs-java_versioned_docs/version-v5/environments/gardener.mdx @@ -135,7 +135,7 @@ For this guide we will be using Docker. Create a `Dockerfile` in the project root directory: ```dockerfile {2} -FROM openjdk:8-jdk-alpine +FROM openjdk:17-jdk-alpine ARG JAR_FILE=application/target/*.jar COPY ${JAR_FILE} app.jar ENTRYPOINT ["java","-jar","/app.jar"] diff --git a/docs-java_versioned_docs/version-v5/environments/kyma.mdx b/docs-java_versioned_docs/version-v5/environments/kyma.mdx index 30b851af30b..cfc85f0eeab 100644 --- a/docs-java_versioned_docs/version-v5/environments/kyma.mdx +++ b/docs-java_versioned_docs/version-v5/environments/kyma.mdx @@ -131,7 +131,7 @@ For this guide we will be using Docker. Create a `Dockerfile` in the project root directory: ```dockerfile {2} -FROM openjdk:8-jdk-slim +FROM openjdk:17-jdk-slim ARG JAR_FILE=application/target/*.jar COPY ${JAR_FILE} app.jar ENTRYPOINT ["java","-jar","/app.jar"] diff --git a/docs-java_versioned_docs/version-v5/faq.mdx b/docs-java_versioned_docs/version-v5/faq.mdx index 27b6eeb352f..351b37a2538 100644 --- a/docs-java_versioned_docs/version-v5/faq.mdx +++ b/docs-java_versioned_docs/version-v5/faq.mdx @@ -32,110 +32,9 @@ Be cautious about using features annotated as _Beta_ because their API can chang ### Which Java Versions Are Supported by the SAP Cloud SDK? -The SAP Cloud SDK itself is compatible with Java 8, 11 [and 17](#spring-boot-3-and-java-17-support). -Other Java versions may work as well, depending on your setup, but are not yet tested by us. -Note that the SAP Business Technology Platform Cloud Foundry environment only supports Java 8 out of the box, but can be configured to also run with Java 11 or 17. - -#### Spring Boot 3 and Java 17 support - -SAP Cloud SDK can be used with JakartaEE (e.g. via Spring Boot 3, Spring 6, and Java 17) thanks to the experimental module `servlet-jakarta`. - -In case you are migrating your application from Spring Boot 2, the below steps make sure the Cloud SDK continues to work smoothly: - -1. Set Spring Boot version to 3 and Java version to 17: - -```xml - - 17 - ${java.version} - ${java.version} - ${java.version} - ${java.version} - -``` - -2. Place the Spring Boot dependency management **before** the SDK BOM: - -```xml - - - - com.sap.cloud.security - java-bom - 3.1.3 - import - pom - - - com.sap.cloud.sdk - sdk-bom - 5.0.0 - pom - import - - - -``` - -3. Replace any `javax` dependency with the respective `jakarta` dependency: - -```diff -- -- javax.inject -- javax.inject -- -+ -+ jakarta.inject -+ jakarta.inject-api -+ 2.0.1 -+ -``` - -Don't forget to replace `javax` imports in Java files with `jakarta` imports. - -Also remember to migrate all your dependencies to their respective `jakarta` versions if applicable. - -For example, if you were previously using `com.sap.hcp.cf.logging:cf-java-logging-support-servlet` for application logging you must instead switch to using `com.sap.hcp.cf.logging:cf-java-logging-support-servlet-jakarta`. - -```diff -- -- com.sap.hcp.cf.logging -- cf-java-logging-support-servlet -- -+ -+ com.sap.hcp.cf.logging -+ cf-java-logging-support-servlet-jakarta -+ latest-lib-version -+ -``` - -4. Add the new `servlet-jakarta` module: - -```xml - - - com.sap.cloud.sdk.cloudplatform - servlet-jakarta - - -``` - -5. When using the `@ServletComponentScan` annotation as suggested, please update the namespace: - -```diff -- @ServletComponentScan({"com.sap.cloud.sdk", ... -+ @ServletComponentScan({"com.sap.cloud.sdk.cloudplatform.servletjakarta", ... -``` - -6. Configure Cloud Foundry for Java 17 - -- [Configure SAP Java Buildpack to run with Java 17](https://help.sap.com/docs/btp/sap-business-technology-platform/sapmachine#activation) - - Add the SAPMachine JRE version 17 in you `manifest.yml`: - ```diff - env: - + JBP_CONFIG_COMPONENTS: 'jres: [''com.sap.xs.java.buildpack.jre.SAPMachineJRE'']' - + JBP_CONFIG_SAP_MACHINE_JRE: '{ use_offline_repository: false, version: 17.0.5 }' - ``` +The SAP Cloud SDK is compatible with Java 17 Long-Term-Support (LTS) +Newer Java versions may work as well depending on your setup but are not yet tested by us. +Note that the SAP Business Technology Platform Cloud Foundry environment can be configured to run with Java 17. ### Can I Use Features Annotated as Beta in Production? diff --git a/docs-java_versioned_docs/version-v5/features/resilience/resilience.mdx b/docs-java_versioned_docs/version-v5/features/resilience/resilience.mdx index 4f7f7891162..229dc5375ec 100644 --- a/docs-java_versioned_docs/version-v5/features/resilience/resilience.mdx +++ b/docs-java_versioned_docs/version-v5/features/resilience/resilience.mdx @@ -89,7 +89,7 @@ The decorator operates with two kinds of operations: - + Callable @@ -97,7 +97,7 @@ The decorator operates with two kinds of operations: - + Supplier diff --git a/docs-java_versioned_docs/version-v5/getting-started.mdx b/docs-java_versioned_docs/version-v5/getting-started.mdx index 70e818e9a72..14771c1eaff 100644 --- a/docs-java_versioned_docs/version-v5/getting-started.mdx +++ b/docs-java_versioned_docs/version-v5/getting-started.mdx @@ -26,9 +26,9 @@ To get started with the SAP Cloud SDK for Java you can either create a new proje You will need an installation of Java and Maven. :::note Java version compatibility -The SAP Cloud SDK is compatible with all current Long-Term-Support (LTS) releases of Java: 8, 11 [and 17](faq.mdx#spring-boot-3-and-java-17-support). -Other Java versions may work as well depending on your setup but are not yet tested by us. -Note that the SAP Business Technology Platform Cloud Foundry environment only supports Java 8 out of the box but can be configured to also run with Java 11 or 17. +The SAP Cloud SDK is compatible with Java 17 Long-Term-Support (LTS) +Newer Java versions may work as well depending on your setup but are not yet tested by us. +Note that the SAP Business Technology Platform Cloud Foundry environment can be configured to run with Java 17. ::: To start with a clean, new project you can select [one of our archetypes](https://search.maven.org/search?q=com.sap.cloud.sdk.archetypes) and build upon it. @@ -36,92 +36,13 @@ Alternatively, you can follow [these instructions](#integrate-the-cloud-sdk-for- ## Generating a Project from a Maven Archetype -The SAP Cloud SDK provides archetypes based on [Spring](https://spring.io/). +The SAP Cloud SDK provides an archetype based on [Spring 6](https://spring.io/). Run: - - - - -```bash -mvn archetype:generate "-DarchetypeGroupId=com.sap.cloud.sdk.archetypes" \ - "-DarchetypeArtifactId=scp-cf-spring" \ - "-DarchetypeVersion=RELEASE" -``` - -Maven will ask you to provide the following: - -- `groupId` - usually serves as your organization identifier, i.e. `foo.bar.cloud.app` -- `artifactId` - it's your application's name, i.e. `mydreamapp` -- `version` - we recommend keeping `1.0-SNAPSHOT` if you're just starting -- `package` - by default this equals to `groupId`. Change it only if you know what you're doing - -After providing all the interactive values to the CLI it will generate your first SAP Cloud SDK based application: - -```bash -[INFO] Scanning for projects... -[INFO] -[INFO] ------------------< org.apache.maven:standalone-pom >------------------- -[INFO] Building Maven Stub Project (No POM) 1 -[INFO] --------------------------------[ pom ]--------------------------------- -[INFO] -[INFO] >>> maven-archetype-plugin:3.1.2:generate (default-cli) > generate-sources @ standalone-pom >>> -[INFO] -[INFO] <<< maven-archetype-plugin:3.1.2:generate (default-cli) < generate-sources @ standalone-pom <<< -[INFO] -[INFO] -[INFO] --- maven-archetype-plugin:3.1.2:generate (default-cli) @ standalone-pom --- -[INFO] Generating project in Interactive mode -[INFO] .... -[INFO] .... -Define value for property 'groupId': foo.bar.cloud.app -Define value for property 'artifactId' (should match expression '[^_]+'): mydreamapp -[INFO] Using property: artifactId = mydreamapp -Define value for property 'version' 1.0-SNAPSHOT: : -Define value for property 'package' foo.bar.cloud.app: : -[INFO] Using property: gitignore = .gitignore -[INFO] Using property: skipUsageAnalytics = false -Confirm properties configuration: -groupId: foo.bar.cloud.app -artifactId: mydreamapp -artifactId: mydreamapp -version: 1.0-SNAPSHOT -package: foo.bar.cloud.app -gitignore: .gitignore -skipUsageAnalytics: false - Y: : -[INFO] ---------------------------------------------------------------------------- -[INFO] Using following parameters for creating project from Archetype: scp-cf-spring:RELEASE -[INFO] ---------------------------------------------------------------------------- -[INFO] Parameter: groupId, Value: foo.bar.cloud.app -[INFO] Parameter: artifactId, Value: mydreamapp -[INFO] Parameter: version, Value: 1.0-SNAPSHOT -[INFO] Parameter: package, Value: foo.bar.cloud.app -[INFO] Parameter: packageInPathFormat, Value: foo/bar/cloud/app -[INFO] Parameter: package, Value: foo.bar.cloud.app -[INFO] Parameter: version, Value: 1.0-SNAPSHOT -[INFO] Parameter: groupId, Value: foo.bar.cloud.app -[INFO] Parameter: skipUsageAnalytics, Value: false -[INFO] Parameter: gitignore, Value: .gitignore -[INFO] Parameter: artifactId, Value: mydreamapp -[INFO] Project created from Archetype in dir: /home/user/dev/temp/mydreamapp -[INFO] ------------------------------------------------------------------------ -[INFO] BUILD SUCCESS -[INFO] ------------------------------------------------------------------------ -[INFO] Total time: 02:28 min -[INFO] Finished at: 2020-04-19T19:25:33+02:00 -[INFO] ------------------------------------------------------------------------ -``` - - - - ```bash mvn archetype:generate "-DarchetypeGroupId=com.sap.cloud.sdk.archetypes" \ - "-DarchetypeArtifactId=scp-cf-spring-jakarta" \ + "-DarchetypeArtifactId=spring-boot3" \ "-DarchetypeVersion=RELEASE" ``` @@ -186,9 +107,6 @@ package: foo.bar.cloud.app [INFO] ------------------------------------------------------------------------ ``` - - - **Congratulations! You've just set up a brand-new application with the SAP Cloud SDK for Java.** :::tip @@ -276,13 +194,7 @@ In general, the SAP Cloud SDK for Java integrates natively into the [Spring Boot In particular the [SAP Cloud SDK provides listeners](features/multi-tenancy/thread-context.mdx) that can extract tenant and principal information from an incoming request. To ensure these listeners are present, please configure your project accordingly. - - - - -For a **Spring 5** based project please ensure that the application is annotated to scan for components of the SAP Cloud SDK: +Please ensure that the application is annotated to scan for components of the SAP Cloud SDK: ```java @ComponentScan({"com.sap.cloud.sdk", }) @@ -291,39 +203,6 @@ For a **Spring 5** based project please ensure that the application is annotated Also, please check [the Spring version](https://mvnrepository.com/artifact/com.sap.cloud.sdk/sdk-bom/latest) declared in the SAP Cloud SDK BOM doesn't clash with your version of Spring. -:::note Spring Support for Cloud Foundry -For Spring based projects we provide out-of-the-box support only on Cloud Foundry with the archetype `scp-cf-spring`. -::: - - - - -For a **Spring 6** based project please ensure that the application is annotated to scan for components of the SAP Cloud SDK: - -```java -@ComponentScan({"com.sap.cloud.sdk", }) -@ServletComponentScan({"com.sap.cloud.sdk.cloudplatform.servletjakarta", }) -``` - -Add the jakarta servlet dependency to your pom.xml: - -```xml - - com.sap.cloud.sdk.cloudplatform - servlet-jakarta - -``` - -And, in case you are using the `sdk-bom`, make sure to set the Spring and XSUAA Library versions before importing the bom. -You can find more details about the configuration for Java 17 / Spring 6 / Spring Boot 3 [here](/docs/java/frequently-asked-questions#which-java-versions-are-supported-by-the-sap-cloud-sdk). - -:::note Spring Support for Cloud Foundry -For Spring based projects we provide out-of-the-box support only on Cloud Foundry with the archetype `scp-cf-spring`. -::: - - - - :::note SAP Cloud SDK Modules Bill-of-Material By default, the SAP Cloud SDK archetypes reference the SAP Cloud SDK Bill-of-Material `sdk-bom`, which manages dependency versions for all SAP Cloud SDK modules and transitive dependencies. diff --git a/docs-java_versioned_docs/version-v5/guides/linux-how-to.mdx b/docs-java_versioned_docs/version-v5/guides/linux-how-to.mdx index bfb24852e30..66187d2801b 100644 --- a/docs-java_versioned_docs/version-v5/guides/linux-how-to.mdx +++ b/docs-java_versioned_docs/version-v5/guides/linux-how-to.mdx @@ -27,12 +27,10 @@ No initial knowledge is required. ### Installing the Java Development Kit and Maven -SAP Cloud SDK supports Java 8, Java 11 and [Java 17](faq.mdx#spring-boot-3-and-java-17-support). - -I'll base this example on Java 8. +SAP Cloud SDK supports Java 17. ```bash -sudo apt-get install openjdk-8-jdk +sudo apt-get install openjdk-17-jdk ``` Updating alternatives to make sure the right version of Java is used. @@ -58,11 +56,11 @@ Check what Java versions you have on your machine with: update-java-alternatives --list ``` -After installing OpenJDK 8 you should now have both Java 8 and Java 11. +After installing OpenJDK 17 you should now have both Java 17 and Java 11. ```bash java-1.11.0-openjdk-amd64 1111 /usr/lib/jvm/java-1.11.0-openjdk-amd64 -java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64 +java-1.17.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.17.0-openjdk-amd64 ``` To switch between Java versions run: @@ -71,29 +69,28 @@ To switch between Java versions run: sudo update-alternatives --config java ``` -In my case, I have to press **2** to make Java 8 default. +In my case, I have to press **2** to make Java 17 default. ```bash Selection Path Priority Status ------------------------------------------------------------ 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode *1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode -2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode +2 /usr/lib/jvm/java-17-openjdk-amd64/jre/bin/java 1081 manual mode Press to keep the current choice[*], or type selection number: ``` Check the Java version again. -Mind, the `version` parameter has just one hyphen for Java 8 CLI. ```bash java -version ``` -You have now switched to Java 8. +You have now switched to Java 17. ```bash -openjdk version "1.8.0_232" -OpenJDK Runtime Environment (build 1.8.0_232-8u232-b09-0ubuntu1.1-b09) +openjdk version "17.0.8.101" +OpenJDK Runtime Environment (build jdk-17.0.8.101-8u232-b09-0ubuntu1.1-b09) OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode) ``` @@ -114,9 +111,9 @@ mvn --version You'll see the maven version and build details. ```bash -Apache Maven 3.6.1 +Apache Maven 3.9.4 Maven home: /usr/share/maven -Java version: 1.8.0_232, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre +Java version: 17.0.8.1, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64/jre Default locale: en_US, platform encoding: ANSI_X3.4-1968 OS name: "linux", version: "5.3.0-26-generic", arch: "amd64", family: "unix" ``` @@ -149,7 +146,7 @@ Another supported IDE is [Eclipse](https://www.eclipse.org/ide/). ### To Initialize Your SAP Cloud SDK App From the Maven Archetype ```bash -mvn archetype:generate -DarchetypeGroupId=com.sap.cloud.sdk.archetypes -DarchetypeArtifactId=scp-cf-spring -DarchetypeVersion=RELEASE +mvn archetype:generate -DarchetypeGroupId=com.sap.cloud.sdk.archetypes -DarchetypeArtifactId=spring-boot3 -DarchetypeVersion=RELEASE ``` The snippet above will create a `Spring Boot` app. diff --git a/docs-java_versioned_docs/version-v5/guides/logging-overview.mdx b/docs-java_versioned_docs/version-v5/guides/logging-overview.mdx index 43e24a3a5b4..a1bb3eafc3e 100644 --- a/docs-java_versioned_docs/version-v5/guides/logging-overview.mdx +++ b/docs-java_versioned_docs/version-v5/guides/logging-overview.mdx @@ -311,7 +311,7 @@ Mind that a value set via the CLI will be overridden if you re-deploy your appli #### Recommendation for Spring Boot (e.g. SAP Cloud Application Programming Model) It's possible to customize the log levels and formatting of your Spring Boot application, e.g. when using the [SAP Cloud Application Programming Model (CAP)](https://cap.cloud.sap/docs/) framework. -For this we recommend the best practices as they are used in our [`scp-cf-spring`](https://sap.github.io/cloud-sdk/docs/java/getting-started#generating-a-project-from-a-maven-archetype) Maven archetype. +For this we recommend the best practices as they are used in our [`spring-boot3`](../getting-started#generating-a-project-from-a-maven-archetype) Maven archetype. If not exist, add a `src/main/resources/logback-spring.xml` with the following contents: diff --git a/docs-java_versioned_docs/version-v5/guides/spring-boot-war-deployment.mdx b/docs-java_versioned_docs/version-v5/guides/spring-boot-war-deployment.mdx index 6b34a3cb6d0..251cd40bed5 100644 --- a/docs-java_versioned_docs/version-v5/guides/spring-boot-war-deployment.mdx +++ b/docs-java_versioned_docs/version-v5/guides/spring-boot-war-deployment.mdx @@ -27,7 +27,7 @@ The advantage of that modern deployment form is that the application can be star ## Target Projects of This Guide This guide is applicable to all Spring-based Java projects which use the modern deployment of Spring as jar file. -That comprises in the first place any project using the [new CAP stack](https://cap.cloud.sap/docs/) as well as the [Spring Boot Maven archetype](https://search.maven.org/artifact/com.sap.cloud.sdk.archetypes/scp-cf-spring) of the SAP Cloud SDK. +That comprises in the first place any project using the [new CAP stack](https://cap.cloud.sap/docs/) as well as the [Spring Boot Maven archetype](https://search.maven.org/artifact/com.sap.cloud.sdk.archetypes/spring-boot3) of the SAP Cloud SDK. The problem with the modern deployment is that the [SAP Java Connector](https://support.sap.com/en/product/connectors/jco.html) library cannot be used when the application gets deployed as jar file. That results in runtime exceptions like `java.lang.NoClassDefFoundError: com/sap/conn/jco/JCoException`. diff --git a/docs-java_versioned_docs/version-v5/overview.mdx b/docs-java_versioned_docs/version-v5/overview.mdx index 88d12825325..d6d73bd107e 100644 --- a/docs-java_versioned_docs/version-v5/overview.mdx +++ b/docs-java_versioned_docs/version-v5/overview.mdx @@ -182,10 +182,9 @@ Currently supported environments are : ### Supported Java Versions -The SAP Cloud SDK for Java runs with Java 8 or higher. -For Spring based applications Java 11 [and 17](faq.mdx#spring-boot-3-and-java-17-support) are supported. +The SAP Cloud SDK for Java runs with Java 17. -For apps built on TomEE / Tomcat Java 11 is supported. +Support for apps built on TomEE / Tomcat will come after the release of SAP Java Buildpack 2. ### Supported Frameworks