Course topics

By WebNest Studio

Spring Framework Tutorial

Setting Up Your IDE for Spring

You can write Spring code in any text editor, but an IDE gives you code completion for Spring annotations, one-click running, a debugger, and inspection of your beans and configuration properties. Three choices dominate: IntelliJ IDEA, Eclipse with Spring Tools, and Visual Studio Code with the Spring extensions.

This lesson shows how to install and prepare each one, how to open and run a Spring Initializr project, and which extra tools every Spring developer should have.

IntelliJ IDEA

IntelliJ IDEA is the most popular Java IDE in professional teams. It understands Maven and Gradle projects, offers strong refactoring tools, and includes a built-in HTTP client and database tools. The deepest Spring-specific support (bean navigation, configuration-property completion, endpoint views) is part of the paid Ultimate features, and JetBrains has been changing how its editions are packaged, so check the JetBrains site for what your edition includes. You can build and run Spring applications in any edition.

  • Install on Windows: winget install JetBrains.IntelliJIDEA, or use the installer from jetbrains.com. On macOS: brew install --cask intellij-idea.
  • Open a project with File, Open and select the folder that contains pom.xml or build.gradle. IntelliJ imports it as a Maven or Gradle project.
  • Set the project SDK under File, Project Structure, Project, and choose your JDK 17 or newer.
  • Run by clicking the green arrow next to the main method of the class annotated with SpringBootApplication.
  • Enable annotation processing (Settings, Build, Compiler, Annotation Processors) if you use Lombok.

Eclipse with Spring Tools

Eclipse is free and long established in enterprise Java. Install the "Eclipse IDE for Enterprise Java and Web Developers" package from eclipse.org, then add Spring Tools from the Eclipse Marketplace (Help, Eclipse Marketplace, search for "Spring Tools"). Spring Tools adds a Boot dashboard, live application information, and completion for application properties.

  • Import a generated project with File, Import, Maven, Existing Maven Projects (or Gradle, Existing Gradle Project).
  • Make sure Eclipse runs on a JDK, not a JRE: Window, Preferences, Java, Installed JREs.
  • Run with right-click on the project, Run As, Spring Boot App, or from the Boot Dashboard view.

Visual Studio Code

VS Code is lightweight and starts fast. Install VS Code (on Windows: winget install Microsoft.VisualStudioCode), then add two extension packs from the Extensions view: Extension Pack for Java (language support, debugging, Maven and Gradle integration) and the Spring Boot Extension Pack (Spring Boot tooling, dashboard and Initializr support). VS Code will ask for a JDK if it cannot find one; point it to the JDK that JAVA_HOME uses.

  • Create a project from the command palette: Spring Initializr: Create a Maven Project.
  • Run and debug using the Run and Debug panel, or the Spring Boot Dashboard.
  • If VS Code reports the wrong Java version, set java.jdt.ls.java.home in your settings.

Other tools every Spring developer needs

Beyond the IDE, install a few supporting tools. They make everything in later lessons easier.

  • Git for version control (Windows: winget install Git.Git).
  • An HTTP client to call your APIs: curl (already on most systems), Postman (winget install Postman.Postman), or the HTTP client built into your IDE.
  • Docker Desktop for databases and message brokers in later lessons (winget install Docker.DockerDesktop).
  • A database tool. The H2 in-memory database needs no installation, which makes it ideal while learning.

A quick IDE checklist

Before you continue, confirm that: the IDE uses the same JDK version as your terminal; the project imports without red errors; you can run the main class and see the Spring banner in the console; and the console shows the port (normally 8080) when the application starts. If the IDE and the terminal disagree, the cause is almost always a different JDK.

Examples

Install the extras on Windows with winget (all IDs exist in the winget catalogue)

Java
winget install EclipseAdoptium.Temurin.21.JDK
winget install Microsoft.VisualStudioCode
winget install JetBrains.IntelliJIDEA
winget install Git.Git
winget install Postman.Postman
winget install Docker.DockerDesktop

Install the same tools on macOS with Homebrew

Java
brew install --cask temurin@21
brew install --cask intellij-idea
brew install --cask visual-studio-code
brew install git

Common Mistakes

  • Opening the parent folder of the project instead of the folder that contains pom.xml, so the IDE does not detect a Maven or Gradle project.
  • Letting the IDE use a different JDK than the terminal, which leads to "works in the IDE, fails in Maven" problems.
  • Ignoring annotation processing when using Lombok, then wondering why getters and setters are missing.
  • Running the wrong class. Run the class that has the main method and the SpringBootApplication annotation.

Key Points to Remember

  • IntelliJ IDEA, Eclipse with Spring Tools, and VS Code with the Java and Spring Boot extension packs all work well for Spring.
  • Always point the IDE at a JDK 17 or newer and keep it consistent with your terminal.
  • Import the folder that contains pom.xml or build.gradle so the IDE detects the build tool.
  • Install Git, an HTTP client and Docker Desktop early; later lessons rely on them.

Practice the examples

Change an input, predict the result, then compare it with the output. Explain why the result changes.

Use your local JDK or project IDE for these examples. Codelab currently runs Python and HTML/CSS/JavaScript; framework examples may need project dependencies.