TestController.java 825 B

123456789101112131415161718192021222324252627282930
  1. package com.yingying.tourist.web;
  2. import com.yingying.tourist.result.MessageResult;
  3. import org.springframework.stereotype.Controller;
  4. import org.springframework.web.bind.annotation.GetMapping;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.RestController;
  7. import java.util.Map;
  8. @Controller
  9. public class TestController {
  10. @GetMapping(value = {"/",""})
  11. public MessageResult<String> home(){
  12. return new MessageResult<String>().ok("hello,home");
  13. }
  14. @GetMapping("hello")
  15. public MessageResult<String> helloWorld(){
  16. return new MessageResult<String>().ok("hello,world");
  17. }
  18. @RequestMapping("/index")
  19. public String index(Map<String, Object> map){
  20. map.put("user", "YeLuoFengXing");
  21. return "index";
  22. }
  23. }