Creating RESTful Web Services with Spring boot

How to create a RESTful Spring boot, well as we mention in Create a Spring Project the best way to create a Spring boot project is using the Spring Initializr start.spring.io. I recommend you follow steps 1 and 2 mentioned in Create a Spring Project.

1 . Enter Spring initializr and select the Project and Spring Boot version

Introduce in the browser the next URL: https://start.spring.io/

Once you are in the spring initializr, select the Project, here is it on you to select Maven o Gradle, If you are a beginner I recommend selecting Maven Project.

Then select the Spring boot version is recommended to use the last stable spring version, in this case, we select the 2.7.2 version, please don’t use the SNAPSHOTS or M3  versions, because they are not stable versions and they continue working on it.

2 . Add the Project Metadata

In the next step, you need to add the Project Metadata to our Spring project.

  • Group: This is the base package of our project.
  • Artifact: This is the name that we are giving to our project.
  • Name: This is the name of the artifact
  • Description: This is the description of your project.
  • Packaging: This option indicates if we need the project as a Jar or war, I recommend selecting the Jar because we don’t need anything from the web at this moment.
  • Java: Selec the java version that you will use, I recommend using java 11 because in the time that we are writing this tutorial java 11 is the stable version.
Spring project with all the project metadata

3 . Add the Spring boot dependencies

In this step we need to click in the Add Dependencies button, a popup where we can add the dependencies.

Now we add the next dependencies:

  • Spring Web
  • devtools – Spring Boot Devtools
  • Spring Data JPA (optional)
  • H2 Database (optional)

4 . Generate the Project

Finally, click on the Generate button to create our project.

After the project is downloaded you can import the recently created project with your favorite IDE and start to work on it.

Happy Learning!!

Leave a comment