에러 모음

No mapping for Get

junani0v0 2024. 4. 19. 17:42

< 에러 메시지 >

 

< 원인 >

분명 @Controller와 @RequestMapping 제대로 했는데 계속 No mapping for Get으로 404 에러 발생

뭐지 하고 한참동안 찾다가 contest:component-scan이 설정이 안 돼있어 그렇다는 글을 보고 잘 들어가 있나 확인 처음에는 들어가 있어서 한참고민함 그런데 하나씩 점검을 하던 중 base-package가 다르다는 걸 알게 됨.... 설정파일 전에 프로젝트에서 복붙하고 이번에 패키지 이름을 com.join01.www로 한 게 생각남

 

< 해결 >

	<!-- The controllers are auto-detected POJOs labeled with the @Controller 
		annotation. -->
	<context:component-scan
		base-package="com.join01.www" use-default-filters="false">
		<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
	</context:component-scan>

실제로 위처럼 pf-servlet.xml파일 contest:component-scan 의 base-package 를  com.join01.www으로 바꿔주니 해결....

뭐지 이 허무함은....코드를 잘 보자...