Create Hello world application in Spring Boot using Eclipse| IndianTechnoEra - IndianTechnoEra
Latest update Android YouTube

Create Hello world application in Spring Boot using Eclipse| IndianTechnoEra

Spring Boot,Hello world Program in Spring Boot using Eclipse, Java framework, Java Enterpriser Editon, Spring , Hello World Program , Set up of STS



Step 1: Installation process of eclipse and STS:

(i) Visit the following link: Download Here and select your os 

e.g., I am downloading for window then I click on window x86_64





(ii) Then, click the Download button

(iii) when the download is completed open the eclipse installer for the system where you downloaded it.



(iv) Select the Eclipse IDE for Enterprise Java and Web Developers 



(v) Click the install button:



(vi)Lunch the Eclipse and go to help and then choose the Eclipse Marketplace


(vii)In  the dialog box write Spring tool suite and press enter
(a)Install the Spring Tools 4 aka Spring Tool Suite 4

(b)Confirm, Accept the agreement and Finish

(viii)You will see installing software on the bottom right of your eclipse 

(a)Let it install completely.

(b)After installation, restart the Eclipse.

Step:2 Now, we will create our first program in Spring Boot

(i)Open You Eclipse and go to file new→Other then select Spring Starter Project and enter


(ii)click the Next button

(iii)Give your project name Under the Name Section and click the next button

for example, I gave the name HelloWorld



(iv)Here, select the dependencies according to your project requirement

I am selecting only two dependencies(Spring web and Spring Web Services which are required to create the hello world program.


(v) Click the Finish button

(vii)You will see some dependencies  downloading  on the bottom right of your eclipse 


(viii)Let it install completely, after downloading go to your project and create a package with the 

name com.example.demo.Controller inside the folder src/main/java under the com. example.demo 




(a)right click on the com.example.demo and go to New→Package and enter the name of the package

com.example.demo.Controller and press enter.




(ix)After creating a package, now we will create a Controller Class with the name HelloWorldContorller.

(a)right click on the com.example.demo.Controller and go to New→Class

(b)Enter the class name  under the Name section and click the Finish button


(x) In the Class HelloWorldController.java write the following code

package com.example.demo.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
@RequestMapping("/hello")
public String printhello() {
    return"Hello World";
}
}

(xi) Go to application.properties under the src/main/resources


(a) in the application.properties write the following code: 


(xii) Go to  HelloWorldApplication.java under src/main/javacom.example.demo

and right-click and choose Run as →Spring Boot App



(xiii)When the application runs successfully, it shows a message in the console, as shown in the following figure.

(xiv)Open your browser and invoke the URL https://localhost:8080/hello and press enter it displays a String that we have specified in the Controller.








إرسال تعليق

Feel free to ask your query...
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.