Simple REST method returning an object

In the previous method, we returned a string. Let's create a method that returns a proper JSON response. Take a look at the following method:

    @GetMapping("/welcome-with-object")
public WelcomeBean welcomeWithObject() {
return new WelcomeBean("Hello World");
}

This preceding method returns a simple WelcomeBean initialized with a message: "Hello World".

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset