Skip to content
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

Merged
merged 18 commits into from
Sep 26, 2023

Conversation

hong-sile
Copy link
Member

하디 안녕하세요

이번 3단계 미션에서는 JSON, JSP View를 구현했습니다.
그리고 레거시 MVC도 제거했습니다.

이번 리뷰도 잘 부탁드립니다.(늦게 보내드려 죄송하네요)

가감없이 리뷰해주시면 감사하겠습니다.

@hong-sile hong-sile self-assigned this Sep 25, 2023
Copy link

@jundonghyuk jundonghyuk left a 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();

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값이 겹칠 것 같은데요 !

혹시 이 부분도 고려해보셨는지 궁금해서 여쭤봅니다 !!

제가 잘못생각한 것이라면 말씀 부탁드립니다 !

Copy link
Member Author

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();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JsonView는 필요할 때 마다 생성될 것이라고 예상됩니다 ! (진짜 스프링에서는 인스턴스 하나로 관리할까요 ?)

그렇다면 멤버변수인 ObjectMapper도 그에 맞춰 항상 생성될 것 같은데요

이를 static하게 두는 것에 대해 어떻게 생각하시나요 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확실히 그게 좋은 것 같네요.

하디는 객체가 생성되는 것을 꼼꼼하게 잡아주시는 것 같아요. 👍

Comment on lines 24 to 27
if (model.size() == 1) {
return objectMapper.writeValueAsString(model.values().toArray()[0]);
}
return objectMapper.writeValueAsString(model);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +42 to +44
@DisplayName("JspView render Test 값이 두개 이상일 떄")
void renderTest2() throws Exception {
final JsonView jsonView = new JsonView();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트 꼼꼼 굿이에요...!

@sonarcloud
Copy link

sonarcloud bot commented Sep 26, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability B 1 Vulnerability
Security Hotspot A 0 Security Hotspots
Code Smell A 8 Code Smells

74.0% 74.0% Coverage
0.0% 0.0% Duplication

warning 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.
Read more here

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Copy link

@jundonghyuk jundonghyuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

홍실 고생하셨습니다 ㅎㅎ

MVC미션에서 함께해서 재밌었습니다 ^_^

@jundonghyuk jundonghyuk merged commit f255462 into woowacourse:hong-sile Sep 26, 2023
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants