Spring
Spring 컨트롤러 이름 변경 후 org.springframework.beans.factory.BeanCreationException 에러 해결 방법
오은이
2024. 11. 19. 10:05
GesipanController의 이름을 PostController로 변경한 후 발생한 "Ambiguous mapping" 오류
이전에 GesipanController와 관련된 매핑이 그대로 남아 있어서 생긴 문제이다.
기본적으로, @RequestMapping이나 @GetMapping 등의 경로가 동일하기 때문에 두 컨트롤러가 같은 경로를 처리하려고 할 때 충돌이 발생
org.springframework.beans.factory.BeanCreationException
해결 방법
@RequestMapping에 해당하는 경로의 이름을 변경한다.
변경 전
@RequestMapping(value = "/searchGesipan.do", method = RequestMethod.GET)
변경 후
@RequestMapping(value = "/searchPost.do", method = RequestMethod.GET)
이후 프로젝트 우클릭 > Maven > Update Project
위에 Project 탭 > clean
톰캣 서버 우클릭 > clean
해주면 에러 해결!