Rest Controller :

package com.springboot.demo.mycoolapp.rest;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController // allows Spring to scan for this class and automatically create a bean for this class
// Bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container.

public class FunRestController {
    //expose "/" that return "Hello World"

    @GetMapping("/") // maps the HTTP GET request to the specified method
    public String sayHello() {
        return "Hello World";
    }

    @GetMapping("/workout")
    public String getDailyWorkout() {
        return "Run for 5km";
    }
}