-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelloWorldController.java
More file actions
28 lines (23 loc) · 984 Bytes
/
HelloWorldController.java
File metadata and controls
28 lines (23 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package ro.raffa.curs.controller.v1;
import org.springframework.context.annotation.Profile;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ro.raffa.curs.dto.HelloRequest;
@RestController
@RequestMapping("/v1")
@Profile("local")
public class HelloWorldController {
@GetMapping(path = "/helloworld/hello1")
public String getHello1() {
return "Hello World";
}
@PostMapping(path = "/helloworld/hello1", consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = {
MediaType.APPLICATION_JSON_VALUE })
public String postHello1(@RequestBody HelloRequest helloRequest) {
return "Hello World : " + helloRequest.getInput();
}
}