Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

Latest commit

 

History

History
143 lines (124 loc) · 4.92 KB

preparation.asciidoc

File metadata and controls

143 lines (124 loc) · 4.92 KB

Preparation for the training

Setup the development environment

Before we dive into the Spring Boot training, please ensure your development environment is ready by downloading and setting up the following software on your Windows machine.

Note

If you want to avoid problems during the training, please DO NOT use paths containing spaces like C:\Program Files

Software List

Setup Instructions

  1. Download and install Git for Windows from the provided link.

  2. Download Apache Maven and extract it to a convenient location on your system (e.g. C:\Programs). Add the location to the PATH environment variable.

  3. Choose and download JDK 21 from either the Oracle JDK or OpenJDK options and install it.

  4. Select and download an IDE of your choice (IntelliJ IDEA, Eclipse, or VSCode) for developing Spring Boot applications.

  5. Download and install Postman for testing your Spring Boot application’s RESTful services.

  6. Create an Github account (if you don’t have any yet).

Please follow the installation instructions on the download pages for each piece of software.

Test the environment

  • Please open terminal and test the environment. The outputs below may differ from the outputs on your environment.

  • Please test the installed JDK version

    javac -version

    You should see in the output the same version you have installed, like this

    javac 21.0.2

    If you don’t see the proper version, check whether your JDK installation is added to the PATH environment variable or whether you have set the JAVA_HOME variable properly.

  • Please test the Maven installation

    mvn -v

    You should see the output like this

    Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546)
    Maven home: /home/ksobkowiak/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5
    Java version: 21.0.2, vendor: Eclipse Adoptium, runtime: /home/ksobkowiak/.sdkman/candidates/java/21.0.2-tem
    Default locale: en, platform encoding: UTF-8
    OS name: "linux", version: "5.15.133.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"

    You should see the Maven version 3.8+. Maven outpu should print the usage of the proper JDK version.

Creating a Simple Spring Boot Application

Now that your development environment is ready, let’s create a simple Spring Boot application using the Spring Initializer. Follow these steps to generate your project:

  1. Go to the Spring Initializer website: https://start.spring.io.

  2. Fill out the form with the following details:

    • Project: Maven Project

    • Language: Java

    • Spring Boot: 3.3.5

    • Group: com.capgemini.training

    • Artifact: sample

    • Package name: com.capgemini.training.sample

    • Packaging: Jar

    • Java: Select the version corresponding to your JDK installation (21)

  3. Under Dependencies, add the following:

    • Spring Web

  4. Once all information is filled in, click on the Generate button to download your project.

Here is how your Spring Initializer should look like with the chosen options:

Spring Initializer
  1. Unzip the downloaded project in a convenient location on your system, like C:\trainings\jbf\workspace.

  2. Open terminal, go to the location where you have extracted the sample application and build it using maven

    mvn clean package
  3. Run the application uasing

    mvn spring-boot:run

    You should see output like this

    ... : Tomcat started on port 8080 (http) with context path ''
    ... : Started SanpleApplication in 17.632 seconds (process running for 18.605)
    ... : Initializing Spring DispatcherServlet 'dispatcherServlet'
    ... : Initializing Servlet 'dispatcherServlet'
    ... : Completed initialization in 1 ms
  4. Open the project in your preferred IDE.

  5. Explore the project structure. You’ll notice that Spring Initializer has created a basic project setup with the selected dependencies included in the pom.xml file.

  6. Look for the SampleApplication.java class and run the application from your IDE.

You’re now ready to start developing your Spring Boot application!