minhyexk
@minhyexk
Reviews Written
6
Average Rating
5.0
Posts
Q&A
์ง๋ฌธ ์์ต๋๋ค!
๋ฐ์์คํ ๋ฐ ๋ต๋ณํด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค!!
- 0
- 3
- 329
Q&A
์ง๋ฌธ ์์ต๋๋ค!
์๊พธ ์ง๋ฌธ๋๋ ค ์ฃ์กํฉ๋๋ค.. ํน์ ๋ฐ์ฒ๋ผ ์์ฑํ๋ฉด ๋ ๊น์?? package hello.core; import hello.core.discount.DiscountPolicy; import hello.core.discount.RateDiscountPolicy; import hello.core.member.*; import hello.core.order.OrderService; import hello.core.order.OrderServiceImpl; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.HashMap; @Configuration public class AppConfig { @Bean public MemoryMemberRepository memorymemberRepository() { return new MemoryMemberRepository(getMap()); } @Bean public HashMap getMap() { return new HashMap(); } @Bean public MemberService memberService() { System.out.println("call AppConfig.memberService"); return new MemberServiceImpl(memberRepository()); } @Bean public MemberRepository memberRepository() { System.out.println("call AppConfig.memberRepository"); return new MemoryMemberRepository(); } @Bean public OrderService orderService() { System.out.println("call AppConfig.orderService"); return new OrderServiceImpl(memberRepository(), discountPolicy()); } @Bean public DiscountPolicy discountPolicy() { return new RateDiscountPolicy(); } }
- 0
- 3
- 329




