|
| 1 | + |
| 2 | +This page provides details on how to set up your development environment to work with |
| 3 | +Oracle Backend for Spring Boot and Microservices. |
| 4 | + |
| 5 | +The following platforms are recommended for a development environment: |
| 6 | + |
| 7 | +- Microsoft Windows 10 or 11, preferrably with Windows Subsystem for Linux 2 |
| 8 | +- macOS (11 or later recommended) on Intel or Apple silicon |
| 9 | +- Linux, for example Oracle Linux, Ubuntu, and so on. |
| 10 | + |
| 11 | +The following tools are recommended for a development environment: |
| 12 | + |
| 13 | +- Integrated Development Environment, for example Visual Studio Code |
| 14 | +- Java Development Kit, for example Oracle, OpenJDK, or GraalVM |
| 15 | +- Maven or Gradle for build and testing automation |
| 16 | + |
| 17 | +If you wish to test locally or offline, then the following additional tools are recommended: |
| 18 | + |
| 19 | +- A container platform, for example Rancher Desktop |
| 20 | +- An Oracle database (in a container) |
| 21 | + |
| 22 | +## Integrated Development Environment |
| 23 | + |
| 24 | +Oracle recommends Visual Studio Code, which you can download [here](https://code.visualstudio.com/), and |
| 25 | +the following extensions to make it easier to write and build your code: |
| 26 | + |
| 27 | +- [Spring Boot Extension Pack](https://marketplace.visualstudio.com/items?itemName=pivotal.vscode-boot-dev-pack) |
| 28 | +- [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) |
| 29 | +- [Oracle Developer Tools](https://marketplace.visualstudio.com/items?itemName=Oracle.oracledevtools) |
| 30 | + |
| 31 | +You can install these by opening the extensions tab (Ctrl-Shift-X or equivalent) and using the |
| 32 | +search bar at the top to find and install them. |
| 33 | + |
| 34 | +## Java Development Kit |
| 35 | + |
| 36 | +Oracle recommends the [Java SE Development Kit](https://www.oracle.com/java/technologies/downloads/#java17) |
| 37 | +or [GraalVM](https://www.graalvm.org/downloads/#). Java 17 or 21 are recommended, note that Spring Boot |
| 38 | +3.0 requires at least Java 17. If you want to use JVM Virtual Threads, then Java 21 is recommended. |
| 39 | + |
| 40 | +**Note**: If you are using Spring Boot 2.x, then Oracle encourages you to use at least Java 17, unless |
| 41 | +you have a specific reason to stay on Java 11. Refer to the [Spring Boot Support](https://spring.io/projects/spring-boot#support) |
| 42 | +page for information on support dates for Spring Boot 2.x. |
| 43 | + |
| 44 | +You can download the latest x64 Java 17 Development Kit from |
| 45 | +[this permalink](https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz). |
| 46 | + |
| 47 | +Decompress the archive in your chosen location (for example your home directory) and then add it to your path: |
| 48 | + |
| 49 | +```bash |
| 50 | +export JAVA_HOME=$HOME/jdk-17.0.3 |
| 51 | +export PATH=$JAVA_HOME/bin:$PATH |
| 52 | +``` |
| 53 | + |
| 54 | +Use the following command to verify it is installed: |
| 55 | + |
| 56 | +```bash |
| 57 | +$ java -version |
| 58 | +java version "17.0.3" 2022-04-19 LTS |
| 59 | +Java(TM) SE Runtime Environment (build 17.0.3+8-LTS-111) |
| 60 | +Java HotSpot(TM) 64-Bit Server VM (build 17.0.3+8-LTS-111, mixed mode, sharing) |
| 61 | +``` |
| 62 | + |
| 63 | +**Note: Native Images:** If you want to compile your Spring Boot microservices into native |
| 64 | +images (which was officially supported from Spring Boot 3.0), then you must use GraalVM, which can be |
| 65 | +downloaded [from here](https://www.graalvm.org/downloads/). |
| 66 | + |
| 67 | +## Maven |
| 68 | + |
| 69 | +You can use either Maven or Gradle to build your Spring Boot applications. If you prefer Maven, then |
| 70 | +follow the steps in this section. If you prefer Gradle, then refer to the next section. |
| 71 | + |
| 72 | +Download Maven from the [Apache Maven website](https://maven.apache.org/download.cgi). |
| 73 | + |
| 74 | +Decompress the archive in your chosen location (for example your home directory) and then add it to your path: |
| 75 | + |
| 76 | +```bash |
| 77 | +$ export PATH=$HOME/apache-maven-3.8.6/bin:$PATH |
| 78 | +``` |
| 79 | + |
| 80 | +Use the following command to verify it is installed (note that your version may give slightly different output): |
| 81 | + |
| 82 | +```bash |
| 83 | +$ mvn -v |
| 84 | +Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63) |
| 85 | +Maven home: /home/mark/apache-maven-3.8.6 |
| 86 | +Java version: 17.0.3, vendor: Oracle Corporation, runtime: /home/mark/jdk-17.0.3 |
| 87 | +Default locale: en, platform encoding: UTF-8 |
| 88 | +OS name: "linux", version: "5.10.102.1-microsoft-standard-wsl2", arch: "amd64", family: "unix" |
| 89 | +``` |
| 90 | + |
| 91 | +## Gradle |
| 92 | + |
| 93 | +Download Gradle using the [instructions on the Gradle website](https://gradle.org/install/). |
| 94 | +Spring Boot is compatible with Gradle version 7.5 or later. |
| 95 | + |
| 96 | +Run the following command to verify that Gradle is installed correctly |
| 97 | + |
| 98 | +```bash |
| 99 | +$ gradle -v |
| 100 | + |
| 101 | +------------------------------------------------------------ |
| 102 | +Gradle 7.6 |
| 103 | +------------------------------------------------------------ |
| 104 | + |
| 105 | +Build time: 2022-11-25 13:35:10 UTC |
| 106 | +Revision: daece9dbc5b79370cc8e4fd6fe4b2cd400e150a8 |
| 107 | + |
| 108 | +Kotlin: 1.7.10 |
| 109 | +Groovy: 3.0.13 |
| 110 | +Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021 |
| 111 | +JVM: 17.0.3 (Oracle Corporation 17.0.3+8-LTS-111) |
| 112 | +OS: Linux 5.10.102.1-microsoft-standard-WSL2 amd64 |
| 113 | +``` |
| 114 | + |
| 115 | +## Oracle Database in a container for local testing |
| 116 | + |
| 117 | +If you want to run an instance of Oracle Database locally for development and testing, then Oracle |
| 118 | +recommends Oracle Database 23c Free. You can start the database in a container with this |
| 119 | +command specifying a secure password: |
| 120 | + |
| 121 | +```bash |
| 122 | +docker run --name free23c -d \ |
| 123 | + -p 1521:1521 \ |
| 124 | + -e ORACLE_PWD=Welcome12345 \ |
| 125 | + container-registry.oracle.com/database/free:latest |
| 126 | +``` |
| 127 | + |
| 128 | +**Note**: If you are using testcontainers, then add the following dependency to your application: |
| 129 | + |
| 130 | +```xml |
| 131 | +<dependency> |
| 132 | + <groupId>org.testcontainers</groupId> |
| 133 | + <artifactId>oracle-free</artifactId> |
| 134 | + <version>1.19.2</version> |
| 135 | + <scope>test</scope> |
| 136 | +</dependency> |
| 137 | +``` |
0 commit comments