controller annotation 변경
This commit is contained in:
@@ -5,25 +5,22 @@ import com.eactive.httpmockserver.api.entity.MockCondition;
|
|||||||
import com.eactive.httpmockserver.api.entity.MockResponse;
|
import com.eactive.httpmockserver.api.entity.MockResponse;
|
||||||
import com.eactive.httpmockserver.api.entity.MockRoute;
|
import com.eactive.httpmockserver.api.entity.MockRoute;
|
||||||
import com.eactive.httpmockserver.api.repository.MockRouteRepository;
|
import com.eactive.httpmockserver.api.repository.MockRouteRepository;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.jayway.jsonpath.JsonPath;
|
import com.jayway.jsonpath.JsonPath;
|
||||||
import com.jayway.jsonpath.PathNotFoundException;
|
import com.jayway.jsonpath.PathNotFoundException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.util.AntPathMatcher;
|
import org.springframework.util.AntPathMatcher;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Controller
|
@RestController
|
||||||
public class MockApiController {
|
public class MockApiController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
+3
-2
@@ -3,13 +3,14 @@ package com.eactive.httpmockserver.common.exception;
|
|||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
@ControllerAdvice
|
@ControllerAdvice(annotations = Controller.class)
|
||||||
public class PortalGlobalExceptionHandler {
|
public class PortalGlobalExceptionHandler {
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
@@ -18,7 +19,7 @@ public class PortalGlobalExceptionHandler {
|
|||||||
public ModelAndView handleIllegalArgumentException(HttpServletRequest request, NotFoundException ex) {
|
public ModelAndView handleIllegalArgumentException(HttpServletRequest request, NotFoundException ex) {
|
||||||
log.error(ex.getMessage());
|
log.error(ex.getMessage());
|
||||||
ModelAndView modelAndView = new ModelAndView();
|
ModelAndView modelAndView = new ModelAndView();
|
||||||
modelAndView.setViewName("common/error/notFoundError");
|
modelAndView.setViewName("error");
|
||||||
modelAndView.addObject("exception", ex);
|
modelAndView.addObject("exception", ex);
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user