Learn How to get started with Spring boot framework. Create your very first REST API using Spring Boot and the @RestController @GetMapping annotation. Whether you're new to Java development or just getting started with Spring Boot, this step-by-step guide will help you understand the core concepts and build a simple "Hello World" RESTful API.
Go to Spring Initializer https://start.spring.io/
and fill out the following details similar to below image and add Spring web dependency
package com.hakeemit.hello.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/hello")
public String hello(){
return "Hello World";
}
}
Your project structure will look like this Once you run the application. Go to http://localhost:8080/hello and you will be able to see the Hello World in the web browser.
Video
Comments
Post a Comment