묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨스프링 핵심 원리 - 기본편
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
-
해결됨실전! Querydsl
nullSafeBuilder메서드를 통해 null처리의 한계
개인 프로젝트를 진행하던중 where절의 조건들을 체이닝하는 과정에서 아래코드를 보면 경우 제일 앞에있는 nameLike()메서드가 null일 경우 에러가 발생하였습니다. and 조건일 경우 , 로 체이닝하면 되었지만 or조건들은 무조건 or()을 통해 연결을 해주어야했습니다.query.selectFrom(member) .where(nameLike("infren").or(nameEq("김영한강사님"))) .fetch();BooleanBuilder를 통해 조건을 처리해도되지만인프런 게시판을 통해알게된 nullSafeBuilder메서드를 만들어서 null처리를 하는 방법을 알게되었습니다. 하지만 몇가지 한계점들을 발견하였습니다.eq문에 null이 들어갈 경우에는 정상적으로 작동하였으나like절, 또는 in절에는 상황에 따라서 null을 넣을 경우 like,in문 자체가 파라미터로 null을 받지 못함으로 인해서 eq와는 다르게 작동하는 것을 발견하였습니다.몇 가지 경우의 테스트를 진행해보았습니다.eq절에 null을 넣을경우like절에 null을 넣을 경우 -> NullPointerExceptionin절에 String타입의 null을 넣을 경우in절에 String[] 타입의 null을 넣을 경우in절에 List<> 타입의 null을 넣을 경우 -> NullPointerExceptionin절에 객체(Team) null을 넣을 경우@Test void eq에Null을넣을때(){ String name = null; List<Member> findMember = query.selectFrom(member) .where(nullSafeBuilder(()-> member.username.eq(name))) .fetch(); assertEquals(findMember.size(),4); } @Test() void like절에_Null을_넣을때(){ String name = null; assertThrows(NullPointerException.class, () -> { List<Member> findMember = query.selectFrom(member) .where(nullSafeBuilder(()-> member.username.like(name))) .fetch(); }); } @Test void in절에_String타입의_Null을_넣을때(){ String name = null; List<Member> findMember = query.selectFrom(member) .where(nullSafeBuilder(()-> member.username.in(name))) .fetch(); assertEquals(findMember.size(),4); } @Test void in절에_String배열타입의_Null을_넣을때(){ String name = null; List<Member> findMember = query.selectFrom(member) .where(nullSafeBuilder(()-> member.username.in(name))) .fetch(); assertEquals(findMember.size(),4); } @Test void in절에_List에_Null을_넣을때(){ List<Team> team = null; assertThrows(NullPointerException.class, () -> { List<Member> findMember = query.selectFrom(member) .where(nullSafeBuilder(()-> member.team.in(team))) .fetch(); }); } @Test void in절에_Team타입의_Null을_넣을때(){ Team team = null; List<Member> findMember = query.selectFrom(member) .where(nullSafeBuilder(()-> member.team.in(team))) .fetch(); assertEquals(findMember.size(),4); } public static BooleanBuilder nullSafeBuilder(Supplier<BooleanExpression> f) { try { return new BooleanBuilder(f.get()); } catch (IllegalArgumentException e) { return new BooleanBuilder(); } }where절안에서 사용하는 함수(like, in...등등)에 따라 파라미터 자체에 null을 받지 못함으로인해 nullSafeBuilder를 통해 해결할 수 없는 경우도 있는것 같습니다.이러한 경우에는 강사님께서 알려주셨던 아래와 같은 방법으로 메서드를 통해 파라미터의 null처리를 해주고private BooleanExpression nameLike(String name){ return name != null ? member.username.like(name) : null; }체이닝할 때는 and조건이면 , 를 사용하고, or조건으로 체이닝을 해야할 경우에는 BooleanBuilder객체에 체이닝하는 방식으로 구현을 해야할 것 같습니다.아래는 프로젝트에 적용했던 동적쿼리문 입니다. 앞서 말했듯이 and조건은 ,로 연결하고 or조건들은 Booleanbuilder객체에 체이닝을 하였습니다.//페이징 처리를 하지않은 동적쿼리문 -> 테스트에서 사용 public List<Article> searchBooleanBuilder(ArticleSearchCond cond) { BooleanBuilder builder = new BooleanBuilder(); builder.or(contentLike(cond.getContent()))//글 내용 keyword검색 .or(nickNameLike(cond.getWriter()))//작성자(닉네임) keyword검색 .or(nameLike(cond.getWriter()))//작성자(이름) keyword검색 .or(tagArticleIn(cond.getArticlesByTagValue()))//태그 keyword검색 .or(restaurantNameLike(cond.getRestaurantName()));//음식점명 keyword검색 return query.selectFrom(article) .where( followMembersIn(cond.getFollowMembers()),//팔로우한 유저로 검색 sidoEq(cond.getSido()),//시도로 검색 sigoonEq(cond.getSigoon()),//시군으로 검색 dongEq(cond.getDong()),//동으로 검색 latitudeBetween(cond.getLatitude()),//위도로 검색 longitudeBetween(cond.getLongitude()),//경도로 검색 categoryEq(cond.getCategory()),//음식점 카테고리로 검색 likeArticleIn(cond.getLikeArticles()),//좋아요누른 게시판 검색 builder//keyword조건 검색 ) .orderBy(article.id.desc())//아이디가 높은 것(최신순)으로 내림차순 .limit(20) .fetch(); }아래는 nullSafeBuilder의 한계를 모른 상태로 구현하였던 에러가 발생하는 코드입니다. radioBtnSearchCond(and조건들), keywordSearchCond(or조건으로 연결)안에 nullsafeBuilder로 null처리한 메서드들이 있습니다. public List<Article> searchByNullSafer(ArticleSearchCond cond) { return query.selectFrom(article) .where( radioBtnSearchCond(cond)//라디로 버튼 검색 조건들 .and(keywordSearchCond(cond))//keyword로 검색 조건들 ) .orderBy(article.id.desc())//아이디가 높은 것(최신순)으로 내림차순 .fetch(); }혹시 nullSafeBuilder를 구현 좋은 방법이 있던가, 다른 좋은 방법을 아시는 분이 있으면 알려주시면 감사하겠습니다.
-
해결됨스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
join 메소드는 리턴값이 있는데 왜 그냥 호출해도 오류가 안나나요?
안녕하세요! 제목처럼 join 메소드는 회원가입시키고 아이디를 리턴해주는데 왜 테스트케이스는 리턴값을 따로 안받아줘도 오류가 나지않나요?memberService.join(member);-> 따로 Long saveId = memberService.join(member);이렇게 안해줘도 오류가 안나서 궁금합니다!
-
미해결[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part3: 유니티 엔진
뭐가 문제인지 모르겠어요 4시간 동안 애쓰고 있답니다...
NullReferenceException: Object reference not set to an instance of an objectUtill.GetOrAddComponent[T] (UnityEngine.GameObject go) (at Assets/Script/Utills/Utill.cs:10)UIManager.ShowPopupUI[T] (System.String name) (at Assets/Script/Mangers/UIManager.cs:23)PlayerControler.Start () (at Assets/Script/PlayerControler.cs:67)먼저 오류 메시지는 이것입니다. 저는 UI_Button 프리펩 위치 Resources-Prefabs-UI-Popup폴더에 있구요UIButton 스크립트 Scripts-UI-Popup 폴더에 있습니다. 이제 코드는 Utill.cs:10 -> T component = go.GetComponent<T>(); UIManager.cs:23 -> T popup = Utill.GetOrAddComponent<T>(go);PlayerControler.cs:67 ->Managers.UI.ShowPopupUI<UIButton>();실행 전 UI_Button 프리펩 딜리트했다가 하이라키에 있는 UI_Button 오브젝트를 다시 프리펩화 한다음 그 오브젝트는 다시 딜리트 하여 실행 해본 결과 UI_Button가 뜨지 않고 저 에러만 납니다.뭐가 문제일까요 ???
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
2-F r선언
#include<bits/stdc++.h> using namespace std; int n, m, j, l, r, temp, ret; int main(){ cin >> n >> m >> j; l = 1, r = l + m - 1; for(int i = 0; i < j; i++){ cin >> temp; if(l <= temp && temp <= r) continue; else if(temp < l){ ret += (l - temp); l = temp; }else{ ret += (temp - r); l += (temp - r); } } cout << ret << '\n'; } #include<bits/stdc++.h> using namespace std; int n, m, j, l, r, temp, ret; int main(){ cin >> n >> m >> j; l = 1; for(int i = 0; i < j; i++){ r = l + m - 1; cin >> temp; if(l <= temp && temp <= r) continue; else if(temp < l){ ret += (l - temp); l = temp; }else{ ret += (temp - r); l += (temp - r); } } cout << ret << '\n'; } 안녕하세요 선생님 질문이 있어 이렇게 글을 남깁니다. r을 반복문 안에다 선언하면 맞고 밖에다 선언하면 틀렸다고 나오는데 도저히 이유를 모르겠습니다.
-
미해결스프링 핵심 원리 - 기본편
@SpringBootApplication안에 싱글톤유지하는 기능이있나요?
[질문 내용]AutoAppConfig에서 @ComponentScan 사용할때는 싱글톤을 사용하기 위해서, @Configuration을 붙여주었는데, 1 . @SpringBootApplication에도 싱글톤 유지하는기능이 있는건가요? 아니면 @Configuration추가로 붙여주어야하나요?2 . @ComponentScan( excludeFilters = @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = Configuration.class) ) @Configuration public class AutoAppConfig { }이렇게 순서 바꿔서 코드 작성하면, @Configuration 붙은거 제외시켜서, autoAppConfig 가 등록이 안되어야 하는데, 왜 등록이 되는건가요?
-
미해결파이썬 알고리즘 문제풀이 입문(코딩테스트 대비)
if __name__=="__main__" 사용 기준
강사님 안녕하세요 :) 유익한 강의 잘 듣고 있습니다!학습 중 궁금한 점이 있어서 질문드립니다.강사님께서 DFS문제 외에도 코드 시작 부분에 이 코드를 작성하실 때가 종종 있는데 혹시 강사님의 사용 기준이 있는지 궁금합니다.ex) [섹션 8] 회장뽑기(플로이드-와샬) 사용 O vs 위상정렬(그래프 정렬) 사용 X
-
해결됨[NarP Series] MVC 프레임워크는 내 손에 [나프2탄]
root-context.xml의 namespace 질문 있습니다.
http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring-1.2.xsdxsd옆에 버전을 쓸 때 mybatis-spring-1.2.xsd1.2라고 적으신 이유가 궁금합니다.mybatis-spring은 pom.xml에서 1.3.1 버전을 받은 것으로 기억합니다.그래서 저는 처음에 1.3.1.xsd로 했더니cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'resources'.라면서 선언을 안 해줬다고 에러가 나옵니다.(실행도 안 됩니다.)그런데 1.2.xsd로 하거나 버전을 적지 않으면 정상적으로 실행되네요.다른 이유가 있을까요...??
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
영속성 컨텍스트 select관련해서 질문드립니다!
EntityManager가 tx종료와 동시에 지워진다고 하셨는데,만약 dml쿼리없이 단순 select만 하게되어서EntityTransaction tx = em.getTransaction(); tx.begin();위의 코드없이 select만 여러번 실행하게될 경우 em가 생겼다 지워졌다 생겼다 지워졌다가 반복된다고 보면 될까요??위와같이 이해를 하여서, 위의 코드를 지우고 아래의 코드를 실행하면, 하나의 트랜잭션으로 묶지 않았기에 두번의 쿼리가 나갈것이라 예상했지만, 쿼리가 한번만 나가는것 같아서요Member member1 = em.find(Member.class, 101L); Member member2 = em.find(Member.class, 101L);
-
미해결자바스크립트 알고리즘 문제풀이 입문(코딩테스트 대비)
리뷰 부탁드립니다.
function solution(a,b){ let answer=0 let n = a.length let m = b.length let len = lt = 0 let char='' let arr =[] let sH = new Map() for(x of b){ if(!sH.has(x)) sH.set(x,1) else sH.set(x, sH.get(x)+1) } for(let rt=0; rt<m; rt++){ char += a[rt] if(sH.has(a[rt])) { sH.set(a[rt], sH.get(a[rt])-1) } if(sH.get(a[rt])==0) { len++ } if(len == sH.size){ answer++ } if(!sH.has(a[rt])) sH.set(a[rt],1) else sH.set(a[rt], sH.get(a[rt])+1) } const copySh = sH console.log(copySh) for(let rt=m; rt<n; rt++){ lt++ char = a.substring(lt, rt) + a.substring(rt, rt+1) if(char.split('').sort().join('')===b){ answer++ } } return answer } let a="bacaAacba"; let b="abc"; console.log(solution(a, b)); 저는 첫번째만 문자열 3개 3개만 hash 사용하여 비교하고 나머지는 sort해서 같은지 비교하는데 이경우도 복잡도 O(n2)일지 궁금합니다..!잘듣고있습니다. 감사합니다
-
미해결AWS Certified Solutions Architect - Associate 자격증 준비하기
실전문제 해설본 pdf 받아보고 싶습니다.
jaehwan0223@gmail.com 으로 보내주시면 감사하겠습니다. - 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.
-
해결됨풀스택을 위한 도커와 최신 서버 기술(리눅스, nginx, AWS, HTTPS, 배포까지) [풀스택 Part3]
인바운드 규칙 설정 방법
안녕하세요, 인바운드 규칙 설정 문의드립니다.[강의 내 docker 주요 규칙 익히기 5 강의]현재는 AWS통해서 gui를 통해, 인바운드 규칙 생성해주시는 법을 알려주셨는데요.만약 제가 사용하고 싶은 서버가 특정 그룹안에서 만들어진 서버 (리눅스 기반)라면, 어떻게 인바운드 규칙을 설정할 수 있을까요? (aws free tier 사이트처럼, 사용자에게 친숙하게 제공되지 않을거 같아서요)환경마다 다를거 같아서 직접 인바운드 규칙 설정하는 방법을 알려 주시기는 번거로우실거 같은데, 혹시 정확히 제가 어떻게 검색을 하면 질문드린 부분을 해결할 수 있을지 답변주시면 감사하겠습니다. (아직 서버, 리눅스 이런 부분에 대한 용어가 익숙치 않아서요)미리 감사드립니다.
-
미해결Three.js로 시작하는 3D 인터랙티브 웹
main.js가 연결되지 않은듯 콘솔 조차 찍히지 않습니다.
제목 그대로 입니다 웹팩 콘피그의 엔트리에도 잘들어가 있고 파일 명을 바꾸면 에러를 뱉는것이 잘 연결되어있는 것 같은데, 콘솔을 찍으면 나오지 않습니다.html에 스크립트를 넣어주면 문제없이 콘솔 찍어 냅니다혹시 예상되는 문제점이 있을까요?
-
미해결프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
강의 자료 문의 드립니다.
강의 자료가 보이지 않아서 이메일을 남깁니다.보내주시면 감사하겠습니다!kimmed25@daum.net
-
해결됨코딩테스트 [ ALL IN ONE ]
[3번 문제] 완전탐색 (DFS, BFS) (후반부)
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.보시면 dfs 끝나고if len(visited) == len(rooms):return True이렇게 되어있는데2번째 구문에서 visited = [False] * len(rooms)를 했기때문에 if len(visited) == len(rooms): 구문은무조건 참이 나올 수 밖에 없는 거 아닌가요?문제를 이해 하다 보니 막혀서 질문 드립니다.
-
미해결실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화
Dto
위강의에 MemberDto에 만약 address필드까지 추가해야한다면 MemberDto 리스트를 만들때List<MemberDto> collect = findMembers.stream() .map(m -> new MemberDto(m.getName(),m.getAddress())) .collect(Collectors.toList()); 위와 같이 해준다면 MemberDto에서의 address와 findMembers에서의 address가 같은 주소값을 참조하고 있어 상황에 따라 뜻하지 않는 에러가 발생할 수 있다고 생각하는데 MemberDto에서 address 객체를 아예 새로 만드는 것이 더 좋을까요?? 현업에서는 어떻게 사용하는지 궁금합니다!
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
6-f 문제는 이해했는데 원래 작성한 코드가 왜 틀렸는지를 잘 모르겠습니다.
틀린 코드https://www.acmicpc.net/source/58095478문제는 이해를 했고 제가 짠 코드가 시간초과가 걸려야한다는 점도 이해했습니다.처음 접근시 이분탐색 + check로 문제를 해결하려고 했는데요.코드에서 naive하게 while문을 이용해서 몬스터의 체력을 공격력을 으로 빼주는 방법을 사용했고 용사가 먼저 때리고, 그다음 맞는 것도 구현했습니다.이런 접근이 기존 시간 복잡도를 logN * N * (100000) 까지 증가할 수 있다는 점은 이해를 했는데, 왜 백준에서는 시간초과가 아닌 틀렸다고 나오는지 이해가 안되서 질문드립니다.로직자체는 맞다고 생각이 드는데 시간초과도 틀리다고 뜰 수 있는걸까요?bool check(long long mid) { long long atk = hatk; long long hhp = mid; for (int i = 0; i < n; ++i) { if (v[i].t == 1) { mhp = v[i].h; matk = v[i].a; /* 왜 백준에서는 시간초과가 아니라 틀렸다고 나올까요? */ while (mhp > 0) { mhp -= atk; if (mhp <= 0) break; hhp -= matk; if (hhp <= 0) return false; } /* answer */ // long long div = mhp / atk + (mhp % atk ? 1 : 0); // long long cnt = div - 1; // hhp -= cnt * matk; } else { heal = v[i].h; addatk = v[i].a; atk += addatk; hhp = min(mid, hhp + heal); } /* answer */ // if (hhp <= 0) return false; } return true; }
-
미해결모든 개발자를 위한 HTTP 웹 기본 지식
캐시 컨텐츠 관련 질문
영상에는 사진으로 예시를 들어서 정적 컨텐츠만 설명하셨는데 api로부터 json을 응답받고 그 값을 max-age 값으로 cache 하는 것 또한 가능한가요?
-
미해결AWS Certified Solutions Architect - Associate 자격증 준비하기
실전문제 영어버전
안녕하세요,실전문제 영어버전 pdf 받을 수 있을까요?가능하다면 아래 이메일로 부탁드립니다.lyl-fp@naver.com감사합니다.
-
미해결혼자 공부하는 머신러닝+딥러닝
경사 하강법의 에포크의 반복에 대해 질문이 있습니다
안녕하세요 강사님 좋은 강의에 감사드립니다.다름이 아니라 경사하강법을 공부 중 의문점이 들어 질문글을 작성하게 되었습니다.에포크를 반복하며 과소-적정-과대 적합으로 성능이 진행되는 것으로 배웠는데요, 211p의 예시에서는 에포크마다 데이터가 새로 추가되지는 않은 것으로 이해를 했습니다.그럼 같은 데이터를 반복해서 학습을 시키는 건데, 그게 성능 개선에 어떻게 영향을 미치고 효과를 발휘하게 되는 것인지 궁금합니다.같은 데이터를 반복한다면 성능 개선이 없어야 하는 것으로 이해가 되어서요