2019/09/18 - [일이야기/Spring] - Tomcat 구동시 ErrorPageFilter 에러 처리
이전 글에서 ErrorPageFilter를 disabled하고 Application 내에서 에러페이지를 분기하려고
GlobalErrorController를 만들었는데 아래와 같은 에러가 발생했다.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'basicErrorController' method public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) to { /error}: There is already 'globalErrorController' bean method
내용을 보면 어쩌구 저쩌구....BasicErrorController.error 에 /error 라는 경로가 이미 있다라고 하네..
BasicErrorController를 사용하지 못하도록 처리해 보자.
Java Config
@Configuration
@EnableAutoConfiguration(exclude = ErrorMvcAutoConfiguration.class)
public class ErrorConfiguration {
....
}
또는
Application.yml
spring:
autoconfigure:
exclude: org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration
'일이야기 > Spring' 카테고리의 다른 글
생성자 주입에 대하여... (0) | 2022.05.17 |
---|---|
mybatis에서 NumberformatException 처리 (0) | 2020.07.01 |
Tomcat 구동시 ErrorPageFilter 에러 처리 (0) | 2019.09.18 |
댓글