March 2018
Intermediate to advanced
140 pages
2h 42m
English
Let's start with creating a simple REST service returning a welcome message. We will create a simple POJO WelcomeBean class with a member field called message and one argument constructor, as shown in the following code snippet:
package com.mastering.spring.springboot.bean;
public class WelcomeBean {
private String message;
public WelcomeBean(String message) {
super();
this.message = message;
}
public String getMessage() {
return message;
}
}Let's start with creating a simple REST Controller method returning a string:
@RestController
public class BasicController {
@GetMapping("/welcome")
public String welcome() {
return "Hello World";
}
}A few important things to note are as follows:
@RestController ...