-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MVC 구현 - 3단계] 홍실(홍혁준) 미션 제출합니다. #620
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요 홍실 ! 고생하셨슴다 !
너무 잘 구현해주셔서 리뷰할게 좀 적네요 ...
궁금한게 있어서 몇 개 달아놨습니다 !
다음 번에는 머지해도 될 것 같습니다 ~
private static final Logger log = LoggerFactory.getLogger(AnnotationHandlerMapping.class); | ||
|
||
private final Object[] basePackage; | ||
private final Map<HandlerKey, HandlerExecution> handlerExecutions; | ||
|
||
public AnnotationHandlerMapping(final Object... basePackage) { | ||
this.basePackage = basePackage; | ||
this.basePackage = Stream.of(basePackage, DEFAULT_CONTROLLER_PACKAGE).toArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AnnotationHandlerMapping
으로 디폴트 컨트롤러 즉 root Path
에 대해 추가하는것이지요 ?
만약 사용자가 /
root path에 대해 index.jsp
가 아닌, 자신의 정적파일을 서빙하고 싶다면 어떻게 될까요 ?
아마 디폴트 컨트롤러랑 key
값이 겹칠 것 같은데요 !
혹시 이 부분도 고려해보셨는지 궁금해서 여쭤봅니다 !!
제가 잘못생각한 것이라면 말씀 부탁드립니다 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 ForwardController를 mvc 패키지에 관리하려고 위와 같이 코드를 작성하였는데, 다른 정적파일을 서빙하는 케이스는 생각을 못했네요.
한 번 고려해보면서 구현해보도록 하겠습니다.
|
||
public class JsonView implements View { | ||
|
||
private final ObjectMapper objectMapper = new ObjectMapper(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JsonView
는 필요할 때 마다 생성될 것이라고 예상됩니다 ! (진짜 스프링에서는 인스턴스 하나로 관리할까요 ?)
그렇다면 멤버변수인 ObjectMapper
도 그에 맞춰 항상 생성될 것 같은데요
이를 static
하게 두는 것에 대해 어떻게 생각하시나요 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확실히 그게 좋은 것 같네요.
하디는 객체가 생성되는 것을 꼼꼼하게 잡아주시는 것 같아요. 👍
if (model.size() == 1) { | ||
return objectMapper.writeValueAsString(model.values().toArray()[0]); | ||
} | ||
return objectMapper.writeValueAsString(model); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@DisplayName("JspView render Test 값이 두개 이상일 떄") | ||
void renderTest2() throws Exception { | ||
final JsonView jsonView = new JsonView(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트 꼼꼼 굿이에요...!
SonarCloud Quality Gate failed. 0 Bugs 74.0% Coverage The version of Java (11.0.20.1) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
홍실 고생하셨습니다 ㅎㅎ
MVC미션에서 함께해서 재밌었습니다 ^_^
하디 안녕하세요
이번 3단계 미션에서는 JSON, JSP View를 구현했습니다.
그리고 레거시 MVC도 제거했습니다.
이번 리뷰도 잘 부탁드립니다.(늦게 보내드려 죄송하네요)
가감없이 리뷰해주시면 감사하겠습니다.