In this tutorial, we will learn how to use spring initializer (spring.io) to create new maven project and add dependencies at the time of project creation.
Steps to make spring project & adding dependencies
1. Go to link start.spring.io to create web project.
2. With the help of “dependencies” box on the top right corner of the screen search for the dependencies.
3. Click on dependency to add it to your project.
4. Under the ‘spring boot’ section, select the version of Spring Boot. You may consider choosing the latest version of Spring Boot.
5. Click on ‘Generate’ button or press ‘ctrl + enter’ key to download the created project.
6. Unzip the downloaded project and import it as existing maven project in your IDE.
Steps to Import the downloaded project in Eclipse
a. Click on ‘Import..’ in the ‘File’ section of top menu in eclipse.
b. Select ‘Existing Maven Project’ from the options in ‘Maven’ section.
c. Now, browse to the folder which we just downloaded and unzipped ‘demo.zip’.
d. Click on ‘Finish’.
e. Now, let the project import completely before starting to add your code in the project. You can view the import status in the bottom right corner of the window.
Hence, we have successfully created a java spring project and added dependencies using spring initializer. You can run your application by right clicking on the ‘DemoApplication.java’ file and selecting ‘run as’-> ‘Java Application’. Your spring has started, see below image.
Now, you can start working on your project and add your code and logics to the project.