출처는 역시 Stackoverflow.
해당 에러는 말그대로
DispatcherServlet 설정에 컨트롤러를 실행하는 HandlerAdapter..객체가 해당 handler=controller에 필요하다. 라는 이야기 같은데. 대부분 개발자의 @Controller 에노테이션이나, @RequestMapping 경로 설정 실수로 보인다.
마음이 급하던 바보인 내가 무슨 일을 했냐면..
@Controller(value = "/sample/*")
@Log4j
public class SampleController {
@RequestMapping(value = "/file")
public void uploadFile(ArrayList<MultipartFile> files) {
files.forEach( f -> {
log.info("file : "+f.getOriginalFilename());
log.info("size : "+f.getSize());
});
}
}
@Controller 에노테이션의 속성값에 경로를 주고 있다...ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ
그리하여..
@RequestMapping 을 주어 경로설정을 다시 수정하니, ..음..아주아주 정상적으로 돌아간다. 방식처리도 하지 않고서 RequestMapping 붙이니 더욱 문제구나...싶었다. 반성한다...ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ
@Controller
@RequestMapping(value = "/sample/*")
@Log4j
public class SampleController {
@RequestMapping(method = RequestMethod.GET, value = "/file")
public void uploadFileView() {
}
@RequestMapping(method = RequestMethod.POST,value = "/file")
public void uploadFile(ArrayList<MultipartFile> files) {
files.forEach( f -> {
log.info("file : "+f.getOriginalFilename());
log.info("size : "+f.getSize());
});
}
}
'Exception' 카테고리의 다른 글
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed (0) | 2020.12.11 |
---|---|
java.lang.IllegalArgumentException: No converter found for return value of type (0) | 2020.12.09 |
엑셀 파일 로딩시 형변환에러 발생 Safe하게 하기 (0) | 2020.10.14 |
log 단계 (0) | 2020.08.20 |
java.sql.Connection 사용 주의 사항. MySQL Connector/J is closed. (0) | 2020.08.07 |