Skip to content

Latest commit

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Simple Java Spring boot web server

hello world in spring on the root path

Using curl to preview the response:

❯ curl localhost:8080/hello\?name=LearnAWS.io
Hello LearnAWS.io! It's 2024-06-19T22:18:38.787292626Z% 

How to run this?

Start the spring web server using mvn

mvn spring-boot:run

Code for GET routes

@GetMapping("/")
publicResponseEntity<String> welcome() {
Stringbody = """ <h1>Welcome to Spring boot</h1> <p>Made by <a href='https://learnaws.io'>LearnAWS.io</a> """;
returnResponseEntity.ok().header("Content-Type", "text/html").body(body);
}
@GetMapping("/hello")
publicStringhello(@RequestParam(value = "name", defaultValue = "World") Stringname) {
returnString.format("Hello %s! It's %s", name, Instant.now());
}

About

A simple hello world web application written in Java spring boot

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages