Hello World in Spring Boot

Installation

Clone the repository from here Click Here

Import Maven based project in any of your Favourite IDE.

./mvnw spring-boot:run

Output

Open in Browser

http://localhost:5000/hello-world

http://localho…


This content originally appeared on DEV Community and was authored by Atharva Siddhabhatti

Alt Spring Boot

Installation

Clone the repository from here Click Here

Import Maven based project in any of your Favourite IDE.

./mvnw spring-boot:run

Output

Open in Browser

http://localhost:5000/hello-world
http://localhost:5000/helloworld-bean

Usage

HelloWorldController.java

helloWorld() method returning a string "Hello World".

@GetMapping("/hello-world")
    public String helloWorld() {
        return "Hello World";
    }

helloWorldBean() method returning a bean.

@GetMapping("/helloworld-bean")
    public HelloWorldBean helloWorldBean() {
        return new HelloWorldBean("Hello World");
    }

helloWorld1() method printing Hello World, 'name' using @PathVariable annotation

@GetMapping("/helloworld/{name}")
    public HelloWorldBean helloWorl1(@PathVariable String name) {
        return new HelloWorldBean(String.format("Hello World, %s", name));
    }

Credits

in28Minutes


This content originally appeared on DEV Community and was authored by Atharva Siddhabhatti


Print Share Comment Cite Upload Translate Updates
APA

Atharva Siddhabhatti | Sciencx (2021-08-22T13:52:59+00:00) Hello World in Spring Boot. Retrieved from https://www.scien.cx/2021/08/22/hello-world-in-spring-boot/

MLA
" » Hello World in Spring Boot." Atharva Siddhabhatti | Sciencx - Sunday August 22, 2021, https://www.scien.cx/2021/08/22/hello-world-in-spring-boot/
HARVARD
Atharva Siddhabhatti | Sciencx Sunday August 22, 2021 » Hello World in Spring Boot., viewed ,<https://www.scien.cx/2021/08/22/hello-world-in-spring-boot/>
VANCOUVER
Atharva Siddhabhatti | Sciencx - » Hello World in Spring Boot. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/08/22/hello-world-in-spring-boot/
CHICAGO
" » Hello World in Spring Boot." Atharva Siddhabhatti | Sciencx - Accessed . https://www.scien.cx/2021/08/22/hello-world-in-spring-boot/
IEEE
" » Hello World in Spring Boot." Atharva Siddhabhatti | Sciencx [Online]. Available: https://www.scien.cx/2021/08/22/hello-world-in-spring-boot/. [Accessed: ]
rf:citation
» Hello World in Spring Boot | Atharva Siddhabhatti | Sciencx | https://www.scien.cx/2021/08/22/hello-world-in-spring-boot/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.