강의

멘토링

커뮤니티

Inflearn Community Q&A

97dnjswhd5264's profile image
97dnjswhd5264

asked

Spring Core Principles - Basic Edition

Spring Container Creation

Bean annotation 위치 질문

Written on

·

290

0

AppConfig.java에서 memberRepository와 discountPolicy에도 @Bean annotation을 붙이는 이유가 궁금합니다. 외부적으론 Service만 사용되고 Bean 로드 시에도 없어도 문제없이 실행되는것으로 보이는데, 특별한 이유가 있을까요?

spring객체지향beancontainer

Answer 1

0

안녕하세요. 97dnjswhd님, 공식 서포터즈 David입니다.

Configuration 클래스에서 @Bean을 붙여주는 이유에 대해서는 본 강의 섹션5 - @Configuration과 싱글톤, @Configuration과 바이트코드 조작의 마법에서 자세히 다루고 있습니다. 참고 부탁드립니다:)

감사합니다.

97dnjswhd5264's profile image
97dnjswhd5264

asked

Ask a question