[Round7] 김문진 - Controller 확장 3#131
Open
moonjin-kim wants to merge 5 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
구현내용
RestContorller 어노테이션을 추가하여 json 응답을 추가하였습니다.
Controller param에 객체를 추가하여 body의 데이터를 역직렬화하여 받도록 개선하였습니다
Summary
Restontroller
HandlerMethod에서 메서드의 bean의 annotation을 확인하여 RestController 어노테이션이면 Json데이터를 랜더링 하였습니다.
또한 null을 반환하여 ViewResolve를 실행하지 않도록 하였습니다.
고민) json으로 화면에 출력하는 것 조차도 View로 생각하고 반환을 해야할까요?
Request Body 역직렬화
기존 cotroller에 req,res의 하위호환을 유지하면서 body의 데이터를 메서드에 맞는 객체로 주입하였습니다.
단 RequestBody 파라미터가 2개 이상이 되면 역직렬화의 문제가 발생할 수 있다 판단하여 1개로 제한하였습니다.