- Documentation: https://docs.spring.io/spring-boot/docs/current/reference/html/index.html
- Guides: http://spring.io/guides
- Building a RESTful Web Service: http://spring.io/guides/gs/rest-service/
- Building REST services with Spring: https://spring.io/guides/tutorials/rest/
Download your IDE of choice (e.g., IntelliJ, Visual Studio Code, or Eclipse). Make sure Java 17 is installed on your system (for Windows, please make sure your JAVA_HOME
environment variable is set to the correct version of Java).
If you consider to use IntelliJ as your IDE of choice, you can make use of your free educational license here.
- File -> Open... -> SoPra server template
- Accept to import the project as a
gradle project
- To build right click the
build.gradle
file and chooseRun Build
The following extensions can help you get started more easily:
vmware.vscode-spring-boot
vscjava.vscode-spring-initializr
vscjava.vscode-spring-boot-dashboard
vscjava.vscode-java-pack
Note: You'll need to build the project first with Gradle, just click on the build
command in the Gradle Tasks extension. Then check the Spring Boot Dashboard extension if it already shows soprafs24
and hit the play button to start the server. If it doesn't show up, restart VS Code and check again.
You can use the local Gradle Wrapper to build the application.
- macOS:
./gradlew
- Linux:
./gradlew
- Windows:
./gradlew.bat
More Information about Gradle Wrapper and Gradle.
./gradlew build
./gradlew bootRun
You can verify that the server is running by visiting localhost:8080
in your browser.
./gradlew test
You can start the backend in development mode, this will automatically trigger a new build and reload the application once the content of a file has been changed.
Start two terminal windows and run:
./gradlew build --continuous
and in the other one:
./gradlew bootRun
If you want to avoid running all tests with every change, use the following command instead:
./gradlew build --continuous -xtest
We recommend using Postman to test your API Endpoints.
If something is not working and/or you don't know what is going on. We recommend using a debugger and step-through the process step-by-step.
To configure a debugger for SpringBoot's Tomcat servlet (i.e. the process you start with ./gradlew bootRun
command), do the following:
- Open Tab: Run/Edit Configurations
- Add a new Remote Configuration and name it properly
- Start the Server in Debug mode:
./gradlew bootRun --debug-jvm
- Press
Shift + F9
or the use Run/Debug "Name of your task" - Set breakpoints in the application where you need it
- Step through the process one step at a time
Have a look here: https://www.baeldung.com/spring-boot-testing