월 17,600원
5개월 할부 시다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결스프링 핵심 원리 - 기본편
프로젝트 생성 오류
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]입문 강의를 듣고 기본편으로 넘어왔는데 프로젝트 생성에서 자꾸 오류가 발생해서 질문드립니다 입문편에서 생성한 프로젝트에서는 오류가 뜨지않았었는데 그냥 입문편에서 생성한 프로젝트로 기본편 강의를 들어도 문제없을까요?
- 해결됨스프링 핵심 원리 - 기본편
빈 생성 주기와 콜백
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]안녕하세요. 빈 생성 주기와 콜백에 대해 질문이 있습니다. 강의 자료와 수업중에 스프링 빈의 생명 주기에 대해 다음과 같이 말씀해 주셨는데요.스프링 컨테이너 생성 > 스프링 빈 생성 > 의존관계 주입 > 초기화 콜백 > 사용 > 소멸전 콜백 > 스프링 종료 여기서 콜백은 콜백 함수를 등록했을 때 이 함수가 작동하는? 걸 뜻한다고 이해했습니다. 질문 1 : 콜백에 대해 제가 이해한 것이 맞을 까요? 라이프 사이클에 명시된 '초기화 콜백'과 '소멸전 콜백'은 콜백 함수가 실행되는 시점이다. 질문 2 : 질문 1이 맞다면, 콜백 함수는 필수적인가요? 질문 3 : 콜백이 필수가 아니라면, 콜백을 하지 않은 경우 빈의 라이프 사이클은스프링 컨테이너 생성 > 스프링 빈 생성 > 의존관계 주입 > 빈 초기화 > 사용 > 빈 소멸 > 스프링 종료 이렇게 되는 것이 맞을 까요?
- 미해결스프링 핵심 원리 - 기본편
프로토타입 빈이 클라이언트가 관리하기 시작할 때, 질문 있습니다
=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]프로토타입 빈은, 스프링 컨테이너가 DI까지 완료 후에 클라이언트에게 반환되며 이후의 관리주체는 클라이언트가 한다고 이해했습니다.=> 이게 이해는 가는데.... 아래의 의문점이 해결이 안 되서 질문 드립니다.1) client가 프로토타입 빈을 관리한다면, server의 memory에는 프로토타입 빈 객체 정보가 남아있지 않는 건지 궁금합니다. 1) -1 만약에 server의 memory에 프로토타입 빈 정보가 남아있다면, 클라이언트가 어떤 식으로 관리를 하는 건지 문의드립니다. (서버에 정보가 남아있으니, 클라이언트가 관리를 하게 되면 서버와의 통신비용?이 클라이언트 빈에 비해 증가할 거 같다는 생각이 듭니다. 제가 생각한 것이 맞는지 문의드립니다) 1)-2 만약에 클라이언트가 프로토타입 빈을 종료시키지 않는다면, server의 메모리에 프로토타입 빈 정보가 소멸되지 않고 계속 존재해야 하는 건지 문의드립니다.=> 이로 인해 memory 이슈? 가 생길 거 같다는 생각도 드는데, 혹시 제가 생각하는 것이 맞는지 문의드립니다! 1)-3 혹시나 실무적으로 쓰이는 예시를 정말 사소하게라도 1가지 알고 싶습니다. 언뜻 앞선 질문들을 보니, 실무에서 잘 쓰이지 않는다고는 파악했지만 이게 내용 자체가 이론적이라고 많이 느껴져서.... 문의드립니다!
- 해결됨스프링 핵심 원리 - 기본편
AutoAppConfig에서 @Configuration 사용과 excludeFilters속성 관련해서 질문 드립니다.
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]안녕하세요!수업을 듣던중에 궁금한 부분이 생겨서 질문남깁니다.질문 1. AutoAppConfig에서 @Configuration을 사용한 이유가 궁금합니다.AppConfig에서 @Configuration을 사용한 이유는스프링 빈을 등록할 때, 이미 등록된 빈을 싱글톤으로 보장하기 위함이라고 이해했습니다.실제 테스트 코드를 통해 @Configuration을 사용하지 않았을 때,MemberServiceImpl의 MemoryMemberRepository와 OrderServiceImpl의 MemoryMemberRepository가 다른 인스턴스임을 확인했는데요.AutoAppConfig에서는 ComponentScan을 통해 자동으로 스프링 빈을 등록하고, 실제로 @Configuration을 사용하지 않아도 싱글톤이 적용되는 것 같았습니다.제가 AutoAppConfig에서 @Configuration을 사용하지 않아도 싱글톤이 적용되는지 확인한 방법은1. MemoryMemberRepository의 생성자에 로그를 통해 몇 번 호출되는지 확인 -> 1번 호출2. 테스트 코드로 MemberServiceImpl의 MemoryMemberRepository와 OrderServiceImpl의 MemoryMemberRepository가 같은 인스턴스인지 확인 -> 같은 인스턴스위 2가지 방법으로 확인했습니다.사용하는 것과 사용하지 않는 것은 AutoAppConfig를 스프링 빈으로 등록하냐, 안 하냐의 차이인 거 같은데스프링이 구동될 때, AutoAppConfig를 통해 컴포넌트 스캔을 하고, @Component가 붙은 클래스들을 스프링 빈으로 등록한 후, 더 이상 사용하지 않는다면 AutoAppConfig를 빈으로 등록하지 않아도 되지 않나?라는 생각이 들어서요...혹시 다른 이유가 있는지도 궁금합니다.질문 2. excludeFilters속성을 사용하는 클래스는 대상에서 제외되는지 궁금합니다.추가로 AutoAppConfig의 ComponentScan의 속성에서 excludeFilters로 @Configuration을 적용했는데,AutoAppConfig에도 @Configuration 어노테이션이 붙어있는데 AutoAppConfig는 스프링 빈으로 등록되는 것을 확인했습니다.원래 @ComponentScan의 excludeFilters 속성은 자기 자신 클래스는 제외하고 적용되는 건가요?
- 미해결스프링 핵심 원리 - 기본편
스프링빈과 컴포넌트 스캔 방식
정형화되지 않은 구현체 같은 것은 스프링 bin으로 직접 등록 해야 하고, 정형화된 것은 컴포넌트스캔 방식으로 사용해야 하는 것으로 알고 있습니다. 이렇게 스프링 등록하는 방식이 있던데 각각 왜 그런 방식으로 등록을 해야 하는지 좀더 자세히 설명 부탁드립니다.
- 미해결스프링 핵심 원리 - 기본편
전체 테스트
인텔리제이에서 전체 테스트 실행해보고 싶은데 @Configuration과 바이트코드 조작의 마법 강의 15분 3초를 봐도 잘 모르겠어요 단축키가 있나요?
- 미해결스프링 핵심 원리 - 기본편
생성자 주입, 수정자 주입 테스트 코드
7. 의존관계 자동 주입에서 생성자 주입을 사용해서 단위테스트를 진행하면 NPE가 아닌 컴파일 오류가 발생한다고 하셨는데, 이게 단순히 생성자 주입을 사용해서인가요? 아니면 final 키워드를 사용해서인가요?
- 미해결스프링 핵심 원리 - 기본편
Controller 를 왜 사용했는지 궁금합니다!
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예[질문 내용]안녕하세요 :)빈 스코프 - request 스코프 예제 만들기 10:23에서 LogDemoController 클래스를 만드실 때 @Component가 아닌 @Controller를 사용하셨는데 어떤 이유로 인해 컴포넌트 대신 컨트롤러를 사용하셨는지 궁금합니다!추가로 두 기능들의 사용 용도의 차이점도 궁금합니다!강의 잘 보고 있습니다 영한님 ㅎㅎ 감사합니다.
- 미해결스프링 핵심 원리 - 기본편
스프링 빈 조회
스프링 빈을 왜 test 코드를짜서 검증을 해야하나요? 프레임워크가 자동적으로 컨테이너에 잘 등록했을 텐데 검증하는게 이해가 안가서요
- 해결됨스프링 핵심 원리 - 기본편
IllegalStateException과UnsatisfiedDependencyException이 뜨는데 어디서 잘못됬을까요?
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용] Test파일 실행을 시켜보면 오류가 발생하는데요 도대체 어떤 이유인지 잘 모르겠습니다. 최대한 제가 스스로 해결해보려다가 안되서 질문을 드려봅니다. 다만 걸리는 부분이 있다면 lombok을 설치할 때 build.gradle이 아니라 bulid.gradle.kts라고 되어 있어서 build.gradle로 파일을 변경 시켜주었습니다. 어떻게 해결할 방법이 있나요? org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'member' defined in file [/Users/leedongyoung/스프링 연습/core/out/production/classes/hello/core/member/Member.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'java.lang.Long' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:245) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1352) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1189) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:917) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:93) at hello.core.scan.AutoAppConfigTest.basicScan(AutoAppConfigTest.java:18) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727) at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131) at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86) at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103) at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92) at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86) at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.Long' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1824) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1383) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789) ... 84 more.----------------------------------------- java.lang.IllegalStateException: Failed to load ApplicationContext for [MergedContextConfiguration@387bf2d9 testClass = hello.core.CoreApplicationTests, locations = [], classes = [hello.core.CoreApplication], contextInitializerClasses = [], activeProfiles = [], propertySourceLocations = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@9da1, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@70fab835, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@32057e6, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@53499d85, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@25f9407e, org.springframework.boot.test.context.SpringBootTestAnnotation@c1aac726], contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null] at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:142) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:127) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:141) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:97) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:241) at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:138) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$10(ClassBasedTestDescriptor.java:377) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.executeAndMaskThrowable(ClassBasedTestDescriptor.java:382) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$11(ClassBasedTestDescriptor.java:377) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310) at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735) at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734) at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestInstancePostProcessors(ClassBasedTestDescriptor.java:376) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$instantiateAndPostProcessTestInstance$6(ClassBasedTestDescriptor.java:289) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:288) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$4(ClassBasedTestDescriptor.java:278) at java.base/java.util.Optional.orElseGet(Optional.java:364) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$5(ClassBasedTestDescriptor.java:277) at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:105) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:104) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:68) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86) at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'member' defined in file [/Users/leedongyoung/스프링 연습/core/out/production/classes/hello/core/member/Member.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'java.lang.Long' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:245) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1352) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1189) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:917) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) at org.springframework.boot.test.context.SpringBootContextLoader.lambda$loadContext$3(SpringBootContextLoader.java:137) at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58) at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46) at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1388) at org.springframework.boot.test.context.SpringBootContextLoader$ContextLoaderHook.run(SpringBootContextLoader.java:545) at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:137) at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:108) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:184) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:118) ... 72 moreCaused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.Long' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1824) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1383) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789) ... 96 more
- 미해결스프링 핵심 원리 - 기본편
@SpringBootApplication안에 싱글톤유지하는 기능이있나요?
[질문 내용]AutoAppConfig에서 @ComponentScan 사용할때는 싱글톤을 사용하기 위해서, @Configuration을 붙여주었는데, 1 . @SpringBootApplication에도 싱글톤 유지하는기능이 있는건가요? 아니면 @Configuration추가로 붙여주어야하나요?2 . @ComponentScan( excludeFilters = @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = Configuration.class) ) @Configuration public class AutoAppConfig { }이렇게 순서 바꿔서 코드 작성하면, @Configuration 붙은거 제외시켜서, autoAppConfig 가 등록이 안되어야 하는데, 왜 등록이 되는건가요?
- 미해결스프링 핵심 원리 - 기본편
제어의 역전 IOC
Ioc,DI,그리고 컨테이너 5분 28초에서제어의 역전 설명이 나오는데, 프로그램의 제어 흐름을 직접 제어하는 것이 아니라 외부에서 관리하는 것이 IoC 라고 하는데 여기서 현재 외부에서 관리하는 것이 AppConfig인거고, 내가 작성한 코드를 직접 제어의 흐름을 담당한 것이므로 현재 프레임 워크가 아닌 라이브러리로 개발한 상태라고 이해하는 것이 맞을까요?
- 미해결스프링 핵심 원리 - 기본편
관심사의 분리19분24
인터페이스 discountpolicy에만 의존이 이라고 pdf 에 써있는데 사실상 memberrepository 인터페이스도 의존 이어서 2개 아닌가요? 근데 그냥 생략해서 pdf에 썼다고 보면 될까요?
- 미해결스프링 핵심 원리 - 기본편
관심사의 분리 9분12초 final
final 로 필드 선언하면 무조건 생성자가 기본 할당이 되어야 한다고 하는데 왜 그런건가요?
- 미해결스프링 핵심 원리 - 기본편
깃액션을 이용한 CI&CD 자동배포시 appspec.yml was not found 에러 발생합니다.
학습과 관련 없는 질문이지만 ㅠㅠㅠ 아무리 찾아도 해결방법을 찾지 못해 올립니다. ci . yml 을 통해 ci 는 정상적으로 작동 하고 있습니다. 그리고 deploy.yml 작성하고 , 인텔리제이에서는 필요한 appspec.yml 과 실행관련 스크립트 폴더를 생성 하여 다 됐다고 생각되어 깃허브에 새로운 머지를 했는데 , 아래와 같은 에러가 발생합니다. aws 의 codedeploy에서 배포 로그를 확인 할 수 있다고 해서 들어가봤지만 배포이력자체도 남지 않아 로그확인은 불가 했습니다. ㅠㅠ 무엇이 문제 일까요... appspec.ymlversion: 0.0 os: linux files: - source: / destination: /home/ubuntu/app overwrite: yes permissions: - object: / pattern: "**" owner: ubuntu group: ubuntu hooks: AfterInstall: - location: scripts/stop.sh timeout: 60 runas: ubuntu ApplicationStart: - location: scripts/start.sh timeout: 60 runas: ubuntustart.sh#!/usr/bin/env bash PROJECT_ROOT="/home/ubuntu/app" JAR_FILE="$PROJECT_ROOT/blog-project-0.0.1-SNAPSHOT.jar" APP_LOG="$PROJECT_ROOT/application.log" ERROR_LOG="$PROJECT_ROOT/error.log" DEPLOY_LOG="$PROJECT_ROOT/deploy.log" TIME_NOW=$(date +%c) # build 파일 복사echo "$TIME_NOW > $JAR_FILE 파일 복사" >> $DEPLOY_LOG cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE # jar 파일 실행echo "$TIME_NOW > $JAR_FILE 파일 실행" >> $DEPLOY_LOG nohup java -jar $JAR_FILE > $APP_LOG 2> $ERROR_LOG & CURRENT_PID=$(pgrep -f $JAR_FILE) echo "$TIME_NOW > 실행된 프로세스 아이디 $CURRENT_PID 입니다." >> $DEPLOY_LOGstop.sh#!/usr/bin/env bash PROJECT_ROOT="/home/ubuntu/app" JAR_FILE="$PROJECT_ROOT/blod-project-0.0.1-SNAPSHOT.jar" DEPLOY_LOG="$PROJECT_ROOT/deploy.log" TIME_NOW=$(date +%c) # 현재 구동 중인 애플리케이션 pid 확인 CURRENT_PID=$(pgrep -f $JAR_FILE) # 프로세스가 켜져 있으면 종료if [ -z $CURRENT_PID ]; then echo "$TIME_NOW > 현재 실행중인 애플리케이션이 없습니다" >> $DEPLOY_LOG else echo "$TIME_NOW > 실행중인 $CURRENT_PID 애플리케이션 종료 " >> $DEPLOY_LOG kill -15 $CURRENT_PID fideploy.ymlname: Deploy to Amazon EC2 on: push: branches: - develop # 본인이 설정한 값을 여기서 채워넣습니다. # 리전, 버킷 이름, CodeDeploy 앱 이름, CodeDeploy 배포 그룹 이름 env: AWS_REGION: ap-northeast-2 S3_BUCKET_NAME: [S3 버킷이름 ] CODE_DEPLOY_APPLICATION_NAME: [코드디플로이 어플리케이션 이름 ] CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: [코드디플로이 그룹이름 ] permissions: contents: read jobs: deploy: name: Deploy runs-on: ubuntu-latest environment: production steps: # (1) 기본 체크아웃 - name: Checkout uses: actions/checkout@v3 # (2) JDK 17 세팅 - name: Set up JDK 17 uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: '17' - name: make application.yml run: | touch ./src/main/resources/application.yml echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.yml shell: bash # (3) Gradle build (Test 제외) - name: Build with Gradle uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee with: arguments: clean build -x test # (4) AWS 인증 (IAM 사용자 Access Key, Secret Key 활용) - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ env.AWS_REGION }} # (5) 빌드 결과물을 S3 버킷에 업로드 - name: Upload to AWS S3 run: | aws deploy push \ --application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \ --ignore-hidden-files \ --s3-location s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip \ --source . # (6) S3 버킷에 있는 파일을 대상으로 CodeDeploy 실행 - name: Deploy to AWS EC2 from S3 run: | aws deploy create-deployment \ --application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \ --deployment-config-name CodeDeployDefault.AllAtOnce \ --deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \ --s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip
- 미해결스프링 핵심 원리 - 기본편
회원 도메인 실행과 테스트 8분 37초
private final MemberRepository memberRepository = new MemoryMemberRepository();이 부분이 final로 메소드를 선언하여 오버라이딩을 할 수 없게 한걸까요? 왜 final로 해야 하는지 좀더 자세히 설명 부탁드립니다.
- 미해결스프링 핵심 원리 - 기본편
회원도메인 개발 강의 내용중에서 enum
Enum 으로 회원등급을 작성하는 이유는 뭔가요?Enum 이 뭔지 궁금합니다.
- 미해결스프링 핵심 원리 - 기본편
객체 생성시기 질문
[질문 내용]return new MemberServiceImpl(new MemoryMemberRepository());에서, 강의자료에서는 MemoryMemberRepository()를 생성하고 MemberServiceImpl()를 생성하면서 전달 이라고 나와있는데, 강의에서는 반대로 설명하셔서, 두 객체 중 어느것이 먼저 생성되나요?
- 미해결스프링 핵심 원리 - 기본편
daoImpl이 implements된 Repository인가요?
저는 늘 스프링에서controller -> Service -> ServiceImpl -> Dao -> mapper.xml 이렇게 개발해왔었는데 강의에선 파일명칭?이 달라서 여쭤봅니다. Repository는 dao에서 @Repository로 사용했었는데요 아래 소스의 Repository(MemberRepository)는 위 순서에서 dao에 해당하는 거고 MemoryMemberRepository는 daoImpl (daoImpl,,, 서비스 Impl 하는 것처럼 dao의 구현체 정도라고 생각하면 될까요?
- 미해결스프링 핵심 원리 - 기본편
실무에서 생성자 주입
안녕하세요. 현재 실무 소스가 모두 @Autowired 를 통해 주입이 되어있는데요. 여러 사람의 손을 거쳐가서 그런지 DI가 10개가 넘는 클래스도 있습니다.이럴 경우에도 생성자 주입으로 모두 사용하나요?의존관계가 너무 많으면 생성자 메소드가 너무 길어져서 가독성이 안좋아질텐데 이럴 때 어떻게 하는지 궁금합니다!