Spring Boot教程之九:创建基本应用程序及Hello Word示例

@RestController

public class Controller {

  

    // One syntax to implement a

    // GET method

    @GetMapping("/")

    public String home()

    {

        String str

            = "<html><body><font color=\"green\">"

              + "<h1>WELCOME To GeeksForGeeks</h1>"

              + "</font></body></html>";

        return str;

    }

  

    // Another syntax to implement a

    // GET method

    @RequestMapping(

        method = { RequestMethod.GET },

        value = { "/gfg" })

  

    public String info()

    {

        String str2

            = "<html><body><font color=\"green\">"

              + "<h2>GeeksForGeeks is a Computer"

              + " Science portal for Geeks. "

              + "This portal has been "

              + "created to provide well written, "

              + "well thought and well explained "

              + "solutions for selected questions."

              + "</h2></font></body></html>";

        return str2;

    }

}

上一篇:k8s篇之flannel网络模型详解-1.Flannel 简介