Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. package com.apiapp.springbootproject.controller;
  2.  
  3. import com.apiapp.springbootproject.model.DemoUser;
  4.  
  5. import org.springframework.http.ResponseEntity;
  6. import org.springframework.web.bind.annotation.GetMapping;
  7. import org.springframework.web.bind.annotation.PostMapping;
  8. import org.springframework.web.bind.annotation.RequestBody;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RestController;
  11.  
  12. @RestController
  13. @RequestMapping(value = "/demo")
  14. public class DemoController {
  15.  
  16.     @GetMapping
  17.     public ResponseEntity demoInitiator () {
  18.         return ResponseEntity.ok("Response From Demo Initiator");
  19.     }
  20.  
  21.     @PostMapping
  22.     public ResponseEntity demoInitiator (@RequestBody DemoUser demoUser) {
  23.         return ResponseEntity.ok("Got username as : "+demoUser.getUsername());
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement