Skip to content

[24기_김강민] spring tutorial 미션 제출합니다. - #5

Open
kkangmen wants to merge 3 commits into
CEOS-Developers:kkangmenfrom
kkangmen:kkangmen
Open

[24기_김강민] spring tutorial 미션 제출합니다.#5
kkangmen wants to merge 3 commits into
CEOS-Developers:kkangmenfrom
kkangmen:kkangmen

Conversation

@kkangmen

@kkangmen kkangmen commented Sep 9, 2026

Copy link
Copy Markdown

No description provided.

@9dongs 9dongs left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Spring의 여러 개념을 코드 예시와 함께 정리해주셔서 잘 읽었습니다!
여러 구현체를 주입받는 방법도 BacktestService의 전략 선택 사례와 연결해주셔서 실제로 언제 활용할 수 있는지 이해하기 좋았습니다.
고생하셨습니다!

Comment thread README.md
public OrderServiceImpl(MemberRepository memberRepository, @Qualifier("mainDiscountPolicy") DiscountPolicy discountPolicy)
```

**Collection 주입**

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

여러 구현체를 주입받는 방법을 표로 비교하고, BacktestService에서 전략을 선택하는 사례까지 연결해주셔서 좋았습니다. 각 방식이 어떤 상황에 필요한지 구체적으로 이해할 수 있네요!

@shinae1023 shinae1023 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

과제 수고 많으셨습니다!
생각해보실만한 부분 몇개 남겨두었으니 추가로 공부해보셔도 좋을거같아용

Comment thread README.md
@@ -1,2 +1,461 @@
# spring-tutorial-24th
CEOS 백엔드 24기 스프링 튜토리얼
## AOP(Aspect-Oriented Programming)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AOP의 프록시 구조를 잘 정리해주셨네요! 같은 객체 내부에서 this.someMethod()로 @transactional이나 @around 대상 메서드를 호출해도 AOP가 적용될까요?

Comment thread README.md

```java
@Aspect
public class TimeTraceAop {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

현재 예시의 TimeTraceAop는 @aspect만 선언되어 있는데, 이 클래스는 어떤 과정을 통해 Spring Bean으로 등록되고 프록시 생성에 참여할까요?

Spring의 @AspectJ 활성화 문서 https://docs.spring.io/spring-framework/reference/6.2/core/aop/ataspectj/aspectj-support.html 를 참고해보세용

Comment thread README.md
public OrderServiceImpl(MemberRepository memberRepository, @Qualifier("mainDiscountPolicy") DiscountPolicy discountPolicy)
```

**Collection 주입**

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Map<String, BacktestStrategy>의 key에는 @qualifier 값과 Bean 이름 중 무엇이 들어갈까요? @primary를 붙이면 Map에는 해당 구현체만 주입될까요?

https://docs.spring.io/spring-framework/reference/core/beans/annotation-config/autowired.html

Comment thread README.md
@Service
@RequiredArgsConstructor
@Slf4j
public class BacktestService {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

strategyMap.get() 결과가 없는 경우뿐 아니라 strategy(series) 내부에서 발생한 NullPointerException도 모두 STRATEGY_NOT_FOUND로 변환될 수 있을 것 같습니다. 두 경우를 어떻게 구분하면 좋을까요?

Comment thread README.md
- 스프링은 `DispatcherServlet`이라는 단 1개의 거대한 대표 서블릿만 만들어 두고 모든 요청을 다 받는다. (`즉, 그림에서 파란색 Servlet이 하나만 존재`)
1. `init()` 호출 시점 (스프링 컨테이너의 탄생)
- Tomcat이 켜지고 `DispatcherServlet`을 생성하면서 `init()` 메서드를 호출.
- 바로 이때 `DispatcherServlet`은 내부에 스프링 컨테이너(`ApplicationContext`)를 생성.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

전통적인 WAR 배포 방식과 Spring Boot의 embedded Tomcat 방식에서 ApplicationContext와 DispatcherServlet은 각각 누가 생성할까요?

https://docs.spring.io/spring-boot/reference/web/servlet.html

적어주신 요방법은 전통적인 WAR 방식이긴합니다ㅎㅎ

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

제가 오개념을 알고있었네요!
전통적인 WAR 방식에서는 톰캣이 DispatcherServlet을 생성하고, DispatcherServlet이 ApplicationContext를 생성하는데, 스프링 방식에서는 스프링이 직접 ApplicationContext를 생성하고 이 ApplicationContext가 DispatcherServlet 빈을 생성하여 ServletContext에 등록한다는 점을 알게되었습니다! 감사합니다!

Comment thread README.md
}
```

PSA는 SA뿐 아니라 동일한 코드를 **`다양한 환경 (로컬, 클라우드, 온프레미스)에서 재사용할 수 있도록`** 설계된 추상화이다.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PSA만 보고 트랜잭션 추상화 정도로만 이해하고 있었는데, SA 자체를 먼저 짚어주셔서 PSA가 왜 SA와 환경 이식성이 합쳐진 개념인지 이해가 훨씬 잘 됐습니다 !! 감사합니다 😀

Comment thread README.md

**@Primary**

```java

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

하나의 인터페이스를 구현한 클래스가 여러 개일 때 해결방법을 표로 정리해주신 것도 도움이 많이 됐는데, 특히 밑에 각각에 대한 예시 코드까지 같이 작성해주셔서 언제 어떤 걸 써야 하는지 훨씬 감을 잡기 쉬웠던 것 같습니다 !! 감사합니당 😊

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.

4 participants