Last active
October 28, 2018 20:27
-
-
Save milovtim/d90e4aed64860658479423235e4fac97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface DemoInterface { | |
HelloMsg sayHelloImpl(AddresseeRequest request); | |
@RequestMapping(value = "/hello") | |
default HelloMsg sayHello(@RequestBody AddresseeRequest request) { | |
return sayHelloImpl(request); | |
} | |
} | |
@RestController | |
public class DemoController implements DemoInterface { | |
private final String message = "Hello, "; | |
@Override | |
public HelloMsg sayHelloImpl(AddresseeRequest request) { | |
final HelloMsg msg = new HelloMsg(); | |
msg.addressee = request.getName(); | |
msg.message = message + ", " + request.getName(); | |
return msg; | |
} | |
} | |
public class AddresseeRequest { | |
private String name; | |
public String getName() { return name; } | |
public void setName(String name) { this.name = name; } | |
} | |
public class HelloMsg { | |
public String message; | |
public String addressee; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment