SampleController.java 376 B

123456789101112131415161718192021
  1. package yike.example;
  2. import org.springframework.web.bind.annotation.RequestMapping;
  3. import org.springframework.web.bind.annotation.RestController;
  4. @RestController
  5. public class SampleController {
  6. @RequestMapping("/helloworld")
  7. String home() {
  8. return "Hello World!";
  9. }
  10. @RequestMapping("/exception")
  11. String exception() {
  12. int x= 1/0;
  13. return "Hello World!";
  14. }
  15. }