inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

176만명의 커뮤니티!! 함께 토론해봐요.

생성자 주입, 수정자 주입 테스트 코드

미해결

스프링 핵심 원리 - 기본편

7. 의존관계 자동 주입에서 생성자 주입을 사용해서 단위테스트를 진행하면 NPE가 아닌 컴파일 오류가 발생한다고 하셨는데, 이게 단순히 생성자 주입을 사용해서인가요? 아니면 final 키워드를 사용해서인가요?

  • spring
  • 객체지향
ycllyo 댓글 1 좋아요 0 조회수 324

Controller 를 왜 사용했는지 궁금합니다!

미해결

스프링 핵심 원리 - 기본편

[질문 템플릿] 1. 강의 내용과 관련된 질문인가요? 예 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예 3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예 [질문 내용] 안녕하세요 :) 빈 스코프 - request 스코프 예제 만들기 10:23에서 LogDemoController 클래스를 만드실 때 @Component가 아닌 @Controller를 사용하셨는데 어떤 이유로 인해 컴포넌트 대신 컨트롤러를 사용하셨는지 궁금합니다! 추가로 두 기능들의 사용 용도의 차이점도 궁금합니다! 강의 잘 보고 있습니다 영한님 ㅎㅎ 감사합니다.

  • spring
  • 객체지향
  • controller
  • mvc
  • 컨트롤러
dp4455 댓글 1 좋아요 0 조회수 600

스프링 빈 조회

미해결

스프링 핵심 원리 - 기본편

스프링 빈을 왜 test 코드를짜서 검증을 해야하나요? 프레임워크가 자동적으로 컨테이너에 잘 등록했을 텐데 검증하는게 이해가 안가서요

  • spring
  • 객체지향
김지수 댓글 1 좋아요 0 조회수 501

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 more 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 ) ... 96 more

  • spring
  • 객체지향
이동영 댓글 1 좋아요 0 조회수 657

@SpringBootApplication안에 싱글톤유지하는 기능이있나요?

미해결

스프링 핵심 원리 - 기본편

[질문 내용] AutoAppConfig에서 @ComponentScan 사용할때는 싱글톤을 사용하기 위해서, @Configuration을 붙여주었는데, 1 . @SpringBootApplication에도 싱글톤 유지하는기능이 있는건가요? 아니면 @Configuration추가로 붙여주어야하나요? 2 . @ComponentScan( excludeFilters = @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = Configuration.class) ) @Configuration public class AutoAppConfig { } 이렇게 순서 바꿔서 코드 작성하면, @Configuration 붙은거 제외시켜서, autoAppConfig 가 등록이 안되어야 하는데, 왜 등록이 되는건가요?

  • spring
  • 객체지향
donkey 댓글 1 좋아요 0 조회수 375

제어의 역전 IOC

미해결

스프링 핵심 원리 - 기본편

Ioc,DI,그리고 컨테이너 5분 28초에서 제어의 역전 설명이 나오는데, 프로그램의 제어 흐름을 직접 제어하는 것이 아니라 외부에서 관리하는 것이 IoC 라고 하는데 여기서 현재 외부에서 관리하는 것이 AppConfig인거고, 내가 작성한 코드를 직접 제어의 흐름을 담당한 것이므로 현재 프레임 워크가 아닌 라이브러리로 개발한 상태라고 이해하는 것이 맞을까요?

  • spring
  • 객체지향
김지수 댓글 1 좋아요 0 조회수 941

관심사의 분리19분24

미해결

스프링 핵심 원리 - 기본편

인터페이스 discountpolicy에만 의존이 이라고 pdf 에 써있는데 사실상 memberrepository 인터페이스도 의존 이어서 2개 아닌가요? 근데 그냥 생략해서 pdf에 썼다고 보면 될까요?

  • spring
  • 객체지향
김지수 댓글 1 좋아요 0 조회수 368

관심사의 분리 9분12초 final

미해결

스프링 핵심 원리 - 기본편

final 로 필드 선언하면 무조건 생성자가 기본 할당이 되어야 한다고 하는데 왜 그런건가요?

  • spring
  • 객체지향
김지수 댓글 1 좋아요 1 조회수 454

예외 구문에 대해서..

해결됨

나도코딩의 자바 기본편 - 풀코스 (20시간)

try throw catch 구문에서 throw로 예외를 던지면 catch 구문에서 받아서 예외에 대한 내용을 출력한다고 이해를 하고있는데 뒷쪽 강의를 듣다보니 스레드 join,sleep, 파일 읽기 구문을 try catch 구문으로 감쌀때 RuntimeExeption 과 InterruptedEception 그리고 IOException 친구들은 다른 throw catch 구문과 다른 것 같아서 질문 드립니다.. try { thread.join(2500); // 2.5초 대기 } catch (InterruptedException e) { throw new RuntimeException(e); } --------------------------------------------------------------------------- try(BufferedReader br = new BufferedReader(new FileReader("goodjob.txt"))) { String line; while((line = br.readLine()) != null ) { System.out.println(line); } }catch (IOException e) { throw new RuntimeException(); }

  • java
  • 객체지향
동민 댓글 1 좋아요 0 조회수 270

스캐너

해결됨

나도코딩의 자바 기본편 - 풀코스 (20시간)

안녕하세요 나도코딩님 혹시 식별자,스캐너는 자세히 어디에서 언급되는지 알 수 있을까요? 지금 고급편 결제한 상태고 유튭으로 기본편 4시간 반가량 들었습니다! Scanner scanner = new 어쩌고하는 그런 것이 있던데 이것에 대해 빨리 자세히 알고싶습니다(학교강의 따라잡기 위해서 듣는 거라서요..)

  • java
  • 객체지향
rooks calbin 댓글 1 좋아요 0 조회수 422

회원 도메인 실행과 테스트 8분 37초

미해결

스프링 핵심 원리 - 기본편

private final MemberRepository memberRepository = new MemoryMemberRepository(); 이 부분이 final로 메소드를 선언하여 오버라이딩을 할 수 없게 한걸까요? 왜 final로 해야 하는지 좀더 자세히 설명 부탁드립니다.

  • spring
  • 객체지향
댓글 1 좋아요 0 조회수 339

회원도메인 개발 강의 내용중에서 enum

미해결

스프링 핵심 원리 - 기본편

Enum 으로 회원등급을 작성하는 이유는 뭔가요? Enum 이 뭔지 궁금합니다.

  • spring
  • 객체지향
김지수 댓글 2 좋아요 1 조회수 834

객체 생성시기 질문

미해결

스프링 핵심 원리 - 기본편

[질문 내용] return new MemberServiceImpl(new MemoryMemberRepository()); 에서, 강의자료에서는 MemoryMemberRepository()를 생성하고 MemberServiceImpl()를 생성하면서 전달 이라고 나와있는데, 강의에서는 반대로 설명하셔서, 두 객체 중 어느것이 먼저 생성되나요?

  • spring
  • 객체지향
donkey 댓글 1 좋아요 0 조회수 400

스레드 강의에서 코드를 동일하게 작성했는데 결과가 다릅니다.

해결됨

나도코딩의 자바 기본편 - 풀코스 (20시간)

강의에서는 청소가 번갈아가면서 나오는데 여러번 실행해도 한 번도 번갈아가면서 나오지 않습니다..ㅠ -- 사장 청소 시작 -- -- 직원 청소 시작 (Thread) -- (사장)1 번방 청소 중 (사장)3 번방 청소 중 (사장)5 번방 청소 중 (사장)7 번방 청소 중 (사장)9 번방 청소 중 -- 사장 청소 끝 -- (직원)2 번방 청소 중 (Thread) (직원)4 번방 청소 중 (Thread) (직원)6 번방 청소 중 (Thread) (직원)8 번방 청소 중 (Thread) (직원)10 번방 청소 중 (Thread) -- 직원 청소 끝 (Thread) -- -- 사장 청소 시작 -- -- 직원 청소 시작 (Thread) -- (직원)2 번방 청소 중 (Thread) (직원)4 번방 청소 중 (Thread) (직원)6 번방 청소 중 (Thread) (직원)8 번방 청소 중 (Thread) (직원)10 번방 청소 중 (Thread) -- 직원 청소 끝 (Thread) -- (사장)1 번방 청소 중 (사장)3 번방 청소 중 (사장)5 번방 청소 중 (사장)7 번방 청소 중 (사장)9 번방 청소 중 -- 사장 청소 끝 -- 이 두가지만 나오는데 다른 이유가 있을까요..?

  • java
  • 객체지향
동민 댓글 1 좋아요 0 조회수 290

daoImpl이 implements된 Repository인가요?

미해결

스프링 핵심 원리 - 기본편

저는 늘 스프링에서 controller -> Service -> ServiceImpl -> Dao -> mapper.xml 이렇게 개발해왔었는데 강의에선 파일명칭?이 달라서 여쭤봅니다. Repository는 dao에서 @Repository로 사용했었는데요 아래 소스의 Repository(MemberRepository)는 위 순서에서 dao에 해당하는 거고 MemoryMemberRepository는 daoImpl (daoImpl,,, 서비스 Impl 하는 것처럼 dao의 구현체 정도라고 생각하면 될까요?

  • spring
  • 객체지향
qqq2097 댓글 1 좋아요 0 조회수 636

for 문_ 35강 (~까지 수들의 합 구하기)

미해결

나도코딩의 자바 기본편 - 풀코스 (20시간)

질문 -> //1. 2의 거듭제곱 반복문을 이렇게 만들어도 될까요? //2. 2^1, 2^2까지의 총합: ... 입니다. 출력되는 말을 다르게 하고 싶은 데 if 문이 너무 길어집니다. if 문 짧게 하고 만들고 싶습니다. public class _05_For { public static void main(String[] args) { //생각나서 만든 2의 거듭제곱 For 문 // 2의 0승부터 2의 10승까지의 합: 2047이 나와야 한다. // 출력되는 문장들의 말을 다르게 하고 싶다 2^1, 2^2까지의 총합: 이런 식으로 int Sum = 0; for (int s = 0; s < 11; s++) { Sum += Math.pow(2, s); //거듭제곱을 계산하기 위해 Math.pow함수(?)를 가져옴 if(s == 0) { System.out.println("2^0까지의 총합: " + Sum + " 입니다."); } else if (s == 1) { System.out.println("2^1까지의 총합: " + Sum + " 입니다."); } else if (s == 2) { System.out.println("2^2까지의 총합: " + Sum + " 입니다."); } // 2^10까지 표현하기에는 조건문이 너무 많아짐, 줄이는 방법을 알고 싶다. } System.out.println("2^의 1부터 10까지, 모든 수의 총합: " + Sum + " 입니다."); } }

  • java
  • 객체지향
크레이지핫독 댓글 2 좋아요 0 조회수 656

실무에서 생성자 주입

미해결

스프링 핵심 원리 - 기본편

안녕하세요. 현재 실무 소스가 모두 @Autowired 를 통해 주입이 되어있는데요. 여러 사람의 손을 거쳐가서 그런지 DI가 10개가 넘는 클래스도 있습니다. 이럴 경우에도 생성자 주입으로 모두 사용하나요? 의존관계가 너무 많으면 생성자 메소드가 너무 길어져서 가독성이 안좋아질텐데 이럴 때 어떻게 하는지 궁금합니다!

  • spring
  • 객체지향
두봉이 댓글 1 좋아요 1 조회수 488

hashmap사용시 항상 map으로 선언하시나요?

미해결

스프링 핵심 원리 - 기본편

[질문 내용] 여기에 질문 내용을 남겨주세요. 항상 궁금했던건데, 인터페이스의 구현체에서, 구현체 자체 메서드가 있는 구현체들도 있는데, 변경 용이성때문에 항상 상위 타입으로 선언하는건가요? 예를들어, 인터페이스 Map에는 clone메서드가 없고, HashMap에는 clone 메서드가 있는데, Map으로 선언하면, HashMap 자체 메서드들은 사용못하게되는데 구현체 자체 메서드를 사용할 상황도 있을거같은데, 항상 구현 객체 생성할때 상위로 선언하는 이유가 궁금합니다. 구현체 기능을 더 사용한다 vs 변경에 용이하게한다. 둘다 비슷한 느낌이여서 뭐에 우위를 두고 선정해야할지 잘모르겠습니다.

  • spring
  • 객체지향
  • 리스코프치환원칙
donkey 댓글 1 좋아요 2 조회수 1139

객체 지향 설계와 스프링 강의에서 실무 고민

미해결

스프링 핵심 원리 - 기본편

객체 지향 설계와 스프링 강의 5분에 나오는 인터페이스 도입시 추상화라는 비용이 발생한다는데, 인터페이스안에 구현을 찾는 경우 타고 타고 들어가는 과정에서 추상화 비용이 발생한다라고 알아들었는데 잘 이해가 안가서요 좀더 예시를 들어볼 수 있을 까요?

  • spring
  • 객체지향
김지수 댓글 1 좋아요 0 조회수 777

switch case 문 오류

미해결

자바 기초부터 마스터하기 with 은종쌤 (Do it 자바 프로그래밍 입문) - Part 1(기초편)

switch-case문 예제에서 일부러 error를 내려고 13을 써봤는데 error 13월은 0일 까지 있습니다. 이렇게 뜨는데 error만 나올 수 있게 하려면 어떻게 해야하나요? 감사합니다.

  • java
  • 객체지향
Jiyeon Jun 댓글 1 좋아요 0 조회수 355

인기 태그

인프런 TOP Writers

주간 인기글