@Configuration 관련 질문이 하나 있습니다.
586
작성한 질문수 18
지금 이강의르 두번째로 듣고 있습니다. 다름이 아니라
2.4.5 버전의 boot 사용시에는
Creating shared instance of singleton bean 'appConfig'
Creating shared instance of singleton bean 'memberService'
Creating shared instance of singleton bean 'memberRepository'
Creating shared instance of singleton bean 'orderService'
Creating shared instance of singleton bean 'discountPolicy'
이렇게 뜨는듯 합니다.... 제가 검색을 해봤지만 찾을 수가 없어서 혹시 맞는지 궁금합니다.
답변 1
0
안녕하세요. 경재님
혹시 강의에서 설명드린 부분과 어떤 부분이 다른걸까요?
비교해서 알려주시면 도움이 될 것 같아요.
0
AppConfig 에서 @Configuration 은 지우고 @Bean 만 놔두고 테스트를 돌리면
memberRepository 가 3번 만들어 져야하는데 그렇게 안되고
21:10:20.842 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'appConfig'
21:10:20.851 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'memberService'
21:10:20.861 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'memberRepository'
21:10:20.861 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'orderService'
21:10:20.867 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'discountPolicy'
이런식으로 전부 싱글톤으로 만들어 지는듯 합니다
AppConfig 는 CGLIB 로 만들어지진 않고
bean = class hello.core.AppConfig 이렇게 결과과 뜹니다.
0
먼저 늦게 댓글을 달아 죄송합니다.
다름이 아니라 해결을 했습니다. 제가 AppConfig 를 다르게 작성을 햇었는데 그걸 잠시 잊고 돌리다가 질문을 드린거 같습니다... 친절하게 답변해주셔서 감사합니다.
구현체가 동적으로 정해질 때, 팩토리 기법을 사용하나요?
0
41
2
MemberService의 인터페이스를 왜 사용하는지 궁금합니다.
0
72
1
롬복 @Setter를 써야 하는 상황이 있는건가요?
0
87
1
빈 등록 메서드의 파라미터가 빈이 아니어도 되나요?
0
79
1
테스트 속도가 나중에 영향이 있을까요?
0
75
1
gradle 설정 안떠서 질문 남깁니다!
0
116
2
build.gradle로 프로젝트를 여는 이유
0
81
1
provider 사용하는 이유
0
82
1
다음 강의 뭘 들어야 할까요
0
123
2
프로토타입 빈, 직접 destroy 호출 안 할 경우
0
62
1
beanB
0
79
2
퀴즈다시풀기
0
63
1
Gradle로 바꿔도 오류가 똑같이 발생하네요 ㅠㅠ
0
89
2
"중복 등록과 충돌" 강의에서 강사님과 다른 에러가 발생합니다.
0
63
3
run 실행했는데 결과창이 이렇게 뜨네요 왜 그런건가요>
0
102
2
도메인의 정의?
0
57
1
ApplicationContext 질문입니다.
0
60
1
@Scope의 proxyMode를 사용할때 단위 테스트 방법
0
86
2
ai api 선정하기 관련 질문
0
115
2
생성자 자동주입 관련해서
0
60
1
생성자 직접 호출 vs 팩토리 메서드 패턴
0
91
2
Spring에서 SessionScope와 RequestScope는 함께 사용되나요?
1
62
1
12:25
0
74
2
appConfig.xml 오류
0
123
1





