How to create a simple Spring Boot project in start.spring.io

gautham
Eat-Sleep-Code-Repeat
4 min readAug 26, 2020

This is my first set of posts created during my spring boot learning. There is lot of material on the web to explain what spring boot is and why we need to use it, i’m just a newbie in spring boot. This series is my attempt to help learn springboot and code some practical use cases which might help others to learn and get hands on

You have to know the following before you start creating your spring boot project.

  1. Which version of java do you prefer or is supported in your environments
  2. Is there a version of spring boot recommended by your organization or you can choose the latest stable one
  3. Which build automation ( Maven or Gradle ) does your organization prefer to use?
  4. What are the dependencies needed for your project? you will actually be able to get to know about your dependencies based on the architecture diagram or design for your project. Some of the questions to ask yourself are
  • Will you be exposing web services? REST or SOAP?
  • Will you need to connect to any database to store or retrieve data? like MySQL or Oracle DB or MongoDB or any other SQL or NoSQL database.
  • Do you want to use JDBC or JPA for working with databases
  • Do you have any security requirements?like oAuth, spring security, LDAP etc
  • Do you have any connectivity with queues like RabbitMQ, Kafka etc
  • Do you need any specific cloud needs like Azure, AWS , GCP or Pivotal Cloud?
  • Do you have any specific logging requirements?
  • There are lot more categories of dependencies which you can explore yourself on the spring initializr website.

Now Assuming we kind of have answered fairly all the above questions. And you need not worry if you missed out any dependencies, it can always be added in the later stage during development

Steps to create the Spring Boot project

  1. Go to https://start.spring.io/ and it will look something like this
  • Select the Build Automation ( Maven or gradle ). I have chosen Maven
  • Select the Language of programming ( Java or Kotlin or Groovy ) . I have chosen Java
  • Select the Spring boot version that you want. I have selected 2.3.3 version. 2.4.0 is the new upcoming version. I would prefer to select the last stable version if we don’t know which one is recommended
  • Next step would be to provide a group name. I have given com.springboot.demo and a artifact name. The name of your project goes into the artifact. You can also edit your package name and description as per your needs
  • Next select how you want to generate the project, as a JAR or WAR. i would prefer JAR since i will be importing this project in an IDE like eclipse or intellij
  • You would select the version of java. I would go with Java 11 for now.

Now lets look at how to add dependencies. I will just add web dependencies since we will just create a simple REST service with this demo project

  • Click on the add dependencies button
  • Now you will see the list of dependencies. you can scroll or type in the dependency name, eg: i started typing web and selected Spring Web dependency as shown below.
  • Second dependency i will add is the spring boot devtools as shown below. this will help to live reload our project when we make changes in our IDE.
  • Now just verify all the configurations you selected again and to generate the project you can click on Generate button in the bottom of the spring initializr page

This will download a springbootdemo.zip file and when you unzip it it will provide you the project with following files ready to use.

Congratulations, you have just created a spring boot project. You can import this into the IDE of your choice and code and build the features that were required by your project.

--

--

gautham
Eat-Sleep-Code-Repeat

Avid Reader || Blogger || Tech Enthusiast || Working as an Engineering Manager at Atlassian