나머지는 오류가 뜨지 않는데 구글링을 해도 어떻게 해결하는지 잘 모르겠습니다.. 어디가 의심되는지 알려주실수 있나요..? java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:43) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:244) at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:138) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$6(ClassBasedTestDescriptor.java:350) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.executeAndMaskThrowable(ClassBasedTestDescriptor.java:355) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$7(ClassBasedTestDescriptor.java:350) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312) 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:658) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestInstancePostProcessors(ClassBasedTestDescriptor.java:349) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$instantiateAndPostProcessTestInstance$4(ClassBasedTestDescriptor.java:270) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:269) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$2(ClassBasedTestDescriptor.java:259) at java.base/java.util.Optional.orElseGet(Optional.java:369) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$3(ClassBasedTestDescriptor.java:258) at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:101) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:100) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:65) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$1(NodeTestTask.java:111) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:111) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:79) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'memoryMemberRepository' defined in class path resource [hello/core/AutoAppConfig.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=autoAppConfig; factoryMethodName=memberRepository; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [hello/core/AutoAppConfig.class]] for bean 'memoryMemberRepository': There is already [Generic bean: class [hello.core.member.MemoryMemberRepository]; scope=singleton; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [C:\study\core\out\production\classes\hello\core\member\MemoryMemberRepository.class]] bound. at org.springframework.beans.factory.support.DefaultListableBeanFactory.registerBeanDefinition(DefaultListableBeanFactory.java:995) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:295) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:153) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:129) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:343) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:123) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) ... 68 more
13일까지 기한인 20% 할인 쿠폰으로 교안강의를 포함하여 강의 3개를 구매했는데, 뒤늦게 UX 강의가 누락된 것을 확인하였습니다. 좋은 강의임에도 불구하고 할인된 가격으로 구매할 수 있는 기회를 놓친 것이 아까운데 혹시 쿠폰 발급이 가능한가요? 쿠폰 사용에 제한 기간(당일내 사용, 3일내 사용 등)이 있어도 상관없습니다.
[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part8: Entity Framework Core
안녕하세요? Rookiss님. 몬스터가 드랍하는 아이템중에 stackable 아이템이 있어서 DB 조회없이 바로 갯수를 업데이트하고자 하여 아래와 같이 코드를 작성했습니다. 그 후에 다시 인벤토리 아이템을 클라에 통보하기 위하여 조회를 했으나 Stackable Item의 다른 Property가 모두 NULL이 되어 버리네요. 그래서 결국 아이템을 조회한 후에 갯수를 추가하니 정상적으로 처리가 되네요. 질문1 : 이런 경우 entityState를 사용하지 못하고 꼭 데이터베이스에 조회를 해야할 까요? 질문2 : stackable Item의 경우라면 어떤 로직으로 처리를 하는 게 바람직할 지 조언을 부탁드리고자 합니다. ------------------------------------------------------------------------------------ 구글링을 통해 stackoverflow에서 찾아본 결과는 아래와 같습니다. stackoverflow의 답변 https://stackoverflow.com/questions/28479933/after-setting-entitystate-unchanged-the-entity-properties-are-lost => 채택된 답변은 아이템의 갯수를 업데이트하기 전에 먼저 조회를 하라고 합니다. ------------------------------------------------------------------------------------ 제가 작성중인 Dbtransaction 클래스의 메서드입니다. ------------------------------------------------------------------------------------ public static void RewardStackableItem(Player player, GameRoom room, int itemDbId, int totalCount) { if (player == null || room == null || itemDbId == 0) return; ItemDb oldItemDb = new ItemDb() { ItemDbId = itemDbId, Count = totalCount }; // YOU Instance.Push(() => { S_UpdateItem updateItemPacket = new S_UpdateItem(); using (AppDbContext db = new AppDbContext()) { // 방법1. EntityState 로 처리 //db.Entry(oldItemDb).State = EntityState.Unchanged; //db.Entry(oldItemDb).Property(nameof(ItemDb.Count)).IsModified = true; // 방법2 : 데이터베이스에 조회를 한 후에 처리 ItemDb item = db.Items .Single(i => i.OwnerDbId == player.PlayerDbId && i.ItemDbId == itemDbId); item.Count = totalCount; bool success = db.SaveChangesEx(); if (success) { //문제가 발생하는 부분으로 인벤토리의 해당 아이템을 수정하지 않고 그냥 조회 후 인벤토리를 clear한 후에 다시 인벤토리의 아이템을 만들어서 클라에 통보하고자 하였습니다. List<ItemDb> items = db.Items .Where(i => i.OwnerDbId == player.PlayerDbId).ToList(); player.Inven.Items.Clear(); // Me room.Push(() => { foreach (ItemDb itemDb in items) { Item item = Item.MakeItem(itemDb); if (item != null) { player.Inven.Add(item); ItemInfo info = new ItemInfo(); info.MergeFrom(item.Info); updateItemPacket.Items.Add(info); } } player.Session.Send(updateItemPacket); }); } } }); }
thymeleaf를 사용하다 의문점이 들어 질문을 남깁니다. 이 템플릿을 배우는 이유는 restapi상황에서 front와 back이 나눠져있는 상황에 지금 당장 front와 연결할 수 없을 때, 먼저 가상 시나리오를 실행시켜보기 위해서 알아야하는 템플릿을 익히는 것인가요 ??
안녕하세요 여쭈어볼 게 있습니다! 이동하거나 회전할 때 Vector 를 사용하지 않습니까? 그런데 업데이트 함수에서 매초 마다 new 로 동적할당하는 것은 Heap에 그만큼 엄청난 과부하를 준다고 생각이 듭니다. c#은 수동적으로 메모리 관리를 할 수 없으니 사용자가 강제로 삭제를 할 경우 오히려 성능에 악영향을 준다고 알고 있습니다. 그래서 그냥 가비지 컬렉터가 삭제를 알아서 하게 내버려 둬야 한다고 그러더군요. 그래서 굳이 왜 매번 new로 저렇게 해줘도 성능에 아무런 지장이 없을까? 저 방법 말고 임의 고정 값을 스택에 할당하고 그걸 활용하는 것이 성능 향상에 엄청 낫지 않을까? 이렇게 생각이 들기도 합니다. 궁금증을 꼭 풀고 싶습니다 감사합니다!
안녕하세요.. 먼저 초보적인 질문을 하여서 죄송합니다 이전 강의에서는 id 값을 int 가 아닌 Long 값이 빅인트여서 숫자 범위가 더 넓은것 까지 이해가 되었습니다만 그 이상으로 사용하는 의미를 제가 찾아봤습니다. 코드로 설명 드리자면 @Id @GeneratedValue @Column ( name = " member_id " ) private Long id ; 여기서 Long 타입을 주는 이유를 찾아보니 null 값을 허용하려고 사용한다고 찾아봤습니다. 그래서 제가 생각한 이유는, id 값이 값이 없으면 null 값이 허용되고, 자바상엔 오류가 나타나질 않고 실제로 디비에선 자동적으로 숫자값을 올려준다? 라고 이해를 하였습니다만 맞을까요? 만약에 int type 이면 null이 허용이 되는게 아니라 자바로부터 에러가 난다라고 이해를 하였습니다
HTTP API를 POST 기반으로 등록하는 경우 회원 조회 - /mebers/{id} - GET 방식 회원 등록 - /mebers/{id} - POST 방식 회원 삭제 - /mebers/{id} - DELETE 방식 이라고 하셨는데, ID로 회원조회, 수정, 삭제하는 기능을@RequestMapping("/{id}") 로 동일하게 작성하는 경우 아래와 같이 오류가 발생합니다. hellospring.demo.controller.MemberController#getById(long) to { [/api/members/{id}]}: There is already 'memberController' bean method hellospring.demo.controller.MemberController#remove(long) mapped. Ambiguous mapping. Cannot map 'memberController' method hellospring.demo.controller.MemberController#getById(long) to { [/api/members/{id}]}: There is already 'memberController' bean method hellospring.demo.controller.MemberController#remove(long) mapped. GET 방식, PUT 방식, DELETE 방식으로 다르기 때문에 @RequestMapping("/{id}")로 동일하게 작성해도 되는것이 아닌지 질문드립니다. 이