FallbackController.java 827 B

123456789101112131415161718192021222324
  1. package cc.mrbird.febs.gateway.controller;
  2. import cc.mrbird.febs.common.entity.FebsResponse;
  3. import org.springframework.http.HttpStatus;
  4. import org.springframework.web.bind.annotation.PathVariable;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.ResponseStatus;
  7. import org.springframework.web.bind.annotation.RestController;
  8. import reactor.core.publisher.Mono;
  9. /**
  10. * @author MrBird
  11. */
  12. @RestController
  13. public class FallbackController{
  14. @RequestMapping("fallback/{name}")
  15. @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
  16. public Mono<FebsResponse> systemFallback(@PathVariable String name) {
  17. String response = String.format("访问%s超时或者服务不可用", name);
  18. return Mono.just(new FebsResponse().message(response));
  19. }
  20. }