묻고 답해요
141만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨Practical Testing: 실용적인 테스트 가이드
시간대에 따라서 변화하는 로직 테스트 하는 가이드
안녕하세요. 우빈님 시간대에 따라 다른 결과를 주는 로직을 테스트 하는 과정에서 고민이 있어 질문을 드립니다. 우빈님이 강의에서도 언급하셨지만, 시간과 같이 관측할 때마다 달라지는 영역은 외부로 분리하면 테스트하기 쉬워진다고 말씀하셨습니다.!하지만, 현재 서비스 레이어 까지만 분리가 가능하고 컨트롤러에서 LocalDateTime을 파라미터로 받지 못하는 상황입니다. 그래서 컨트롤러를 테스트할 때 어떻게 해야할까 고민을 좀 해봤는데요. 저의 결론은 TimeProvider라는 클래스를 하나 만들어서컨트롤러를 테스트할 때는 이를 mocking하는 방식으로 테스트 코드를 작성했습니다. TimeProvider/** * 시간을 고정하여 테스트하기 위해 사용 */ @Component public class TimeProvider { public LocalDateTime getCurrentLocalDateTime() { return LocalDateTime.now(); } } ControllerGET을 사용하고 싶은데, 외부와 연동해야해서 POST를 사용할 수 밖에 없습니다. ㅠㅠ/** * 인기 메뉴 조회 * 현재 시간대의 식사종류와 일치하는 가장 조회수가 많은 금일 식사 메뉴 조회 */ @PostMapping("/menu/top1-view") public ResponseEntity<SkillResponse> getTop1RestaurantMenuByView(@RequestBody SkillPayload payload, @PageableDefault(size = 1) Pageable pageable) { log.info("request={}", payload); Page<RestaurantMenuResponse> top1RestaurantMenuByView = restaurantService.findTop1RestaurantMenuByView(pageable, timeProvider.getCurrentLocalDateTime()); RestaurantsMenuResponse response = new RestaurantsMenuResponse(top1RestaurantMenuByView.getContent()); return new ResponseEntity<>(response.toSkillResponseUseTextCard(apiVersion), HttpStatus.OK); } Test Code@Test @DisplayName("추천수 가장 많은 메뉴를 1개 조회한다.") void getTop1UosRestaurantMenuByView() throws Exception { // given // 현재 시간을 고정할 시간 생성 LocalDateTime fixedDateTime = LocalDateTime.of(2023, 8, 16, 10, 59, 59); when(timeProvider.getCurrentLocalDateTime()).thenReturn(fixedDateTime); String date = CrawlingUtils.toDateString(fixedDateTime); restaurant restaurant1 = createUosRestaurant(date, STUDENT_HALL, MealType.BREAKFAST, "라면", 0, 0); restaurant restaurant2 = createUosRestaurant(date, MAIN_BUILDING, MealType.BREAKFAST, "김밥", 1, 0); restaurant restaurant3 = createUosRestaurant(date, WESTERN_RESTAURANT, MealType.BREAKFAST, "돈까스", 2, 0); restaurant restaurant4 = createUosRestaurant(date, MUSEUM_OF_NATURAL_SCIENCE, MealType.BREAKFAST, "제육", 2, 1); restaurantRepository.saveAll(List.of(restaurant1, restaurant2, restaurant3, restaurant4)); SkillPayload skillPayload = createSkillPayload(RestaurantName.STUDENT_HALL.name(), MealType.BREAKFAST.name()); // when // then mockMvc.perform(post("/api/v1/text-card/restaurant/menu/top1-view") .contentType(MediaType.APPLICATION_JSON) .content(om.writeValueAsBytes(skillPayload)) .content(om.writeValueAsString(PageRequest.of(0, 1)))) .andDo(print()) .andExpect(status().isOk()) .andExpect(jsonPath("$.version").value(SkillResponse.apiVersion)) .andExpect(jsonPath("$.template").isNotEmpty()) .andExpect(jsonPath("$.template.outputs").isArray()) .andExpect(jsonPath("$.template.outputs[0].textCard").isNotEmpty()) .andExpect(jsonPath("$.template.outputs[0].textCard.text").isString()); } 이런식으로 작성하는 것이 최선일까요?LocalDateTime fixedDateTime = LocalDateTime.of(2023, 8, 16, 10, 59, 59); when(timeProvider.getCurrentLocalDateTime()).thenReturn(fixedDateTime);TimeProvider 클래스를 만들어서 mocking 하는 방법이 최선일까요?혹시 더 좋은 방법을 말씀주시면 감사하겠습니다.! 좋은 강의 만들어 주셔서 감사합니다.^^
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
java.lang.IllegalStateException: Failed to load ApplicationContext
안녕하십니까 영한님!!!잘만 되던 테스트코드가 어느 순간 아래와 같은 오류가 발생합니다. 해결방법들을 찾아보고 시도해보았지만 해결되지 않아 맨 아래에 구글 드라이브 코드 링크 남겨드립니다. java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@6bc25ac2 testClass = spring.lectureA.service.MemberServiceTest, locations = [], classes = [spring.lectureA.LectureAApplication], contextInitializerClasses = [], activeProfiles = [], propertySourceLocations = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@6c130c45, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@20f5239f, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@2fd1433e, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@3c73951, org.springframework.boot.test.context.SpringBootTestAnnotation@6788e070], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:143)at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:127)at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:191)at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:130)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.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is java.lang.IllegalArgumentException: Unrecognized legacy hibernate.hbm2ddl.auto value : create-droat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598)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.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1155)at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608)at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:436)at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)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:1406)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:187)at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:119)... 72 moreCaused by: jakarta.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is java.lang.IllegalArgumentException: Unrecognized legacy hibernate.hbm2ddl.auto value : create-droat org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421)at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1817)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766)... 93 moreCaused by: java.lang.IllegalArgumentException: Unrecognized legacy hibernate.hbm2ddl.auto value : create-droat org.hibernate.tool.schema.Action.interpretHbm2ddlSetting(Action.java:230)at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator$ActionGrouping.determineAutoSettingImpliedAction(SchemaManagementToolCoordinator.java:725)at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator$ActionGrouping.interpret(SchemaManagementToolCoordinator.java:733)at org.hibernate.boot.internal.MetadataImpl.shouldOrderTableColumns(MetadataImpl.java:480)at org.hibernate.boot.internal.MetadataImpl.orderColumns(MetadataImpl.java:400)at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:250)at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:431)at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1455)at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75)at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)... 97 more [수정]create-drop으로 바꾸어도 해결되지 않습니다구글드라이브 링크 남겨드립니다. 감사합니다.https://drive.google.com/file/d/1ZboNJYtcy5yXo5WNBIcKVaWVlfnxAEu4/view?usp=drive_link
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
연관관계 주인 설정 관련질문
강의에서 외래키가 있는 쪽으로 연관관계의 주인을 설정하라고 들었는데,어노테이션을 보니 @OneToMany에만 mappedBy속성이 있고, @ManyToOne에는 mappedBy 속성이 없습니다. 보통 DB에서 외래키는 1:N관계에서 N쪽에서 가지고 있습니다. 그런데 @ManyToOne에 mappedBy가 없고 @OneToMany에만 mappedBy가 있다는 것은 JPA에서 외래키가 있는 방향으로만 연관관계 주인을 설정하도록 막아놓은건가요? 그리고 아직 속성값의 이름이 왜 mappedBy인지 잘 와닿지가 않습니다. members 필드는 단순히 team에 의해 맵핑만 당한다는 의미로 보면 되나요?
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
플러그인 롬복 설치하는 이유
안녕하세요스프링부트와 JPA 활용1 중 섹션1. 프로젝트 생성 강의를 듣고 있는데요.13:04 부분에 플러그인 롬복을 설치하시는데 앞쪽에서 스프링부트 스타터에서 롬복을 받고 빌드를 했는데 플러그인을 따로 설치해주어야 하는 이유가 뭔가요?빌드한 롬복과 플러그인에서 설치하는 롬복은 무슨 차이인지 어떻게 활용되는지 궁금합니다.
-
해결됨실전! Querydsl
Qhello와 EntityManager 오류 질문
버전은 3.0.9를 사용하였습니다.https://docs.google.com/document/d/1j0jcJ9EoXMGzwAA2H0b9TOvRtpwlxI5Dtn3sRtuXQas/edit#heading=h.iayahq64el0u 이거의Querydsl 부트 3.x 설정을 따라하여build.gradle은 이렇게 설정하였습니다.plugins { id 'java' id 'org.springframework.boot' version '3.0.9' id 'io.spring.dependency-management' version '1.1.2' } group = 'study' version = '0.0.1-SNAPSHOT' java { sourceCompatibility = '17' } configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0' compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.h2database:h2' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta' annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta" annotationProcessor "jakarta.annotation:jakarta.annotation-api" annotationProcessor "jakarta.persistence:jakarta.persistence-api" } tasks.named('test') { useJUnitPlatform() } clean { delete file('src/main/generated') }build->clean을 하고 build->compileJava를 하니이런식으로 build에 Hello와 QHello가 같이 생겼습니다. (QuerydslApplication 까지) 그후 테스트를 다음과 같이 작성하였는데package study.querydsl; import com.querydsl.jpa.impl.JPAQueryFactory; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.transaction.annotation.Transactional; import study.querydsl.entity.Hello; import static org.assertj.core.api.Assertions.*; @SpringBootTest @Transactional class QuerydslApplicationTests { @PersistenceContext EntityManager em; @Test void contextLoads() { Hello hello = new Hello(); em.persist(hello); JPAQueryFactory query = new JPAQueryFactory(em); QHello qHello = new QHello("h"); Hello result = query .selectFrom(qHello) .fetchOne(); assertThat(result).isEqualTo(hello); //lombok 동작 확인 (hello.getId()) assertThat(result.getId()).isEqualTo(hello.getId()); } }여기서 첫번째 질문은 @Autowired를 사용하였을 때EntityManager em; 에서 em에 빨간줄이 뜨며 자동 주입을 할 수 없습니다. 'EntityManager' 타입의 bean을 찾을 수 없습니다 라는 오류가 발생 합니다. @Autowired대신 @PersistenceContext를 사용하면 해당 오류가 뜨지 않습니다. 왜 이런건가요?두번째 질문은 심볼 'QHello'을(를) 해결할 수 없습니다 오류가 발생합니다. 빌드에서 QHello와 Hello가 같이 생겨서 그럴까요?다른분들 질문들에 달린 답변들을 보고 따라해보았지만 해결이 되지 않습니다ㅜ
-
해결됨Practical Testing: 실용적인 테스트 가이드
예외 처리에 대한 rest doc 작성하기
안녕하세요!강사님 덕분에 테스트에 많은 관심이 생겨 개인 프로젝트에도 적용을 해보고 있습니다! Rest doc 작성 중 궁금한 점이 생겨 질문드립니다.API의 정상 응답이 아닌 예외 발생 시의 응답도 Rest doc으로 작성하고자 합니다.예를 들어 인증, 인가 관련하여 예외가 발생하는 경우가 있을 때 다음과 같이 생각했습니다.예외 케이스 별로 에러 코드를 상세하게 나누어 세밀한 응답을 전달하기 (ex. 아이디가 틀렸을 때 - 401A, 비밀번호가 틀렸을 때 - 401B, 아이디가 존재하지 않을 때 - 401C 등등..)공통 예외코드로 처리하기 (ex. 인증 실패 시 어떤 경우라도 401 코드 반환)위의 2가지 경우에 어떤 식으로 rest doc을 작성하는 것이 좋을까요? 1번 케이스의 경우는 특정 API 문서마다 함께 적는 것이 좋을 것 같긴 한데 2번 케이스의 경우는 프로젝트 전반적인 공통 예외처리라 별도의 문서 항목으로 1개만 작성하는 게 좋을 지 고민이 됩니다. 혹시 현업에서는 예외 발생 시 응답에 대한 문서도 작성하시는 지 궁금하고 1번, 2번 케이스에 대하여 어떻게 rest doc을 작성하는 것이 다른 인원과 소통하기 편할지 의견 부탁드리겠습니다! 감사합니다.
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
프로젝트 빌드 및 어노테이션 오류
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]pom.xml을 작성하였고, META-INF도 작성하였습디ㅏ. 이제 Member를 만들어서 Entity 어노테이션을 붙이려고 하는데, 어노테이션이 뜨지 않습니다. 또한 우측 하단에 계속 Scanning files to index라고 뜨는데.. 어떻게 된 건지 알 수 있을까요??META-INF 입니다.<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"> <persistence-unit name="hello"> <properties> <!-- 필수 속성 --> <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/> <property name="javax.persistence.jdbc.user" value="sa"/> <property name="javax.persistence.jdbc.password" value=""/> <property name="javax.persistence.jdbc.url" value="jdbc:h2:tcp://localhost/~/test"/> <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/> <!-- 옵션 --> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.use_sql_comments" value="true"/> <!--<property name="hibernate.hbm2ddl.auto" value="create" />--> </properties> </persistence-unit> </persistence> <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>jpa-basic</groupId> <artifactId>ex1-hello-jpa</artifactId> <version>1.0.0</version> <properties> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> <dependencies> <!-- JPA 하이버네이트 --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>5.6.15.Final</version> </dependency> <!-- H2 데이터베이스 --> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>1.4.200</version> </dependency> </dependencies> </project>pom.xml입니다. 자바 11로 진행중이며, 이에 맞게 hibernate와 h2 버전을 변경하였습니다. 우측 하단에 이런 식으로 계쏙 로딩도 되고요.. 왜그런걸까요??
-
미해결실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화
dto vo 개념이 너무 헷갈립니다.
회원생성 부분에서 @PostMapping("/api/v2/members") public CreateMemberResponse saveMemberV2(@RequestBody @Valid CreateMemberRequest request) { Member member = new Member(); member.setName(request.getName()); Long id = memberService.join(member); return new CreateMemberResponse(id); }CreateMemberRequest 가 dto라고 설명하셨는데회원가입시 json값은 값 변경이 없는데 vo가 아닌가요?
-
해결됨자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
updatName 메소드 질문입니다.
안녕하세요 강사님, 강의 잘 듣고있습니다.강의에서 updateName 메소드를 domain에 작성하였는데 그 이유가 궁금합니다. 다른 기능은 userrepository의 메소드를 활용하는 것 같은데 수정 기능은 다른 이유가 궁금합니다.감사합니다.
-
미해결스프링 DB 2편 - 데이터 접근 활용 기술
finditems() 에러
'테스트 - 스프링 부트와 임베디드 모드' 수강 중에 ItemRepositoryTest를 h2를 모두 끄고 동작시켰는데강사님처럼 모두 성공을 뜨지 않고 finditems()에서 에러가 납니다.강의자료 초반에 데이터베이스에서 데이터가 보관되어 있어서 그렇다고 들었는데어떻게 해결해야하나요?? h2는 접속 종료한 상태입니다.
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
h2 테이블 생성이 안됩니다ㅠㅠ
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]여기에 질문 내용을 남겨주세요. 안녕하세요! h2접속하면 저렇게 member 테이블만 뜨고 생성이 안되어있습니다..ㅠ
-
해결됨실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
엔티티 클래스 개발 2 질문
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]"C:\Program Files\Java\jdk-11\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.3.3\lib\idea_rt.jar=50808:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.3.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\민규\OneDrive\바탕 화면\Study\jpashop\out\production\classes;C:\Users\민규\OneDrive\바탕 화면\Study\jpashop\out\production\resources;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-data-jpa\2.7.14\ad7d3be24a386ec45ce020b8922e9d056f7a6835\spring-boot-starter-data-jpa-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-validation\2.7.14\6e88ca463b6d7294f3206da9a57a645ca41b9665\spring-boot-starter-validation-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-thymeleaf\2.7.14\91a1934c6fae08a28665182ab802d41e0b44ffd\spring-boot-starter-thymeleaf-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\2.7.14\300b311c5fb98a2ee547df33a9d37782dddb496e\spring-boot-starter-web-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-aop\2.7.14\c4fb902f51ab09247de60c463761980d0d1a5888\spring-boot-starter-aop-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-jdbc\2.7.14\80b80408b6b75ce0dc2833cb07fd1ce6620d1f3b\spring-boot-starter-jdbc-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\jakarta.transaction\jakarta.transaction-api\1.3.3\c4179d48720a1e87202115fbed6089bdc4195405\jakarta.transaction-api-1.3.3.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\jakarta.persistence\jakarta.persistence-api\2.2.3\8f6ea5daedc614f07a3654a455660145286f024e\jakarta.persistence-api-2.2.3.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.hibernate\hibernate-core\5.6.15.Final\ab14b7cef1fdff654ca81923048a6034d6c7cfa7\hibernate-core-5.6.15.Final.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-jpa\2.7.14\d5f2e34cce48ed4d668e760db200e854cbbe4d87\spring-data-jpa-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aspects\5.3.29\dbcf1c1ce847b0fb186b5dde18968c9a46900f28\spring-aspects-5.3.29.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\2.7.14\5506200907ff3c3458506a8e16866c684f28bdbd\spring-boot-starter-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-el\9.0.78\a39a2f2839516a5d3c05a4c0d7d1252a114a5b91\tomcat-embed-el-9.0.78.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.hibernate.validator\hibernate-validator\6.2.5.Final\a68959c06e5f8ff45faff469aa16f232c04af620\hibernate-validator-6.2.5.Final.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.thymeleaf\thymeleaf-spring5\3.0.15.RELEASE\7170e1bcd1588d38c139f7048ebcc262676441c3\thymeleaf-spring5-3.0.15.RELEASE.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.thymeleaf.extras\thymeleaf-extras-java8time\3.0.4.RELEASE\36e7175ddce36c486fff4578b5af7bb32f54f5df\thymeleaf-extras-java8time-3.0.4.RELEASE.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-json\2.7.14\34fbe387993dafef8b2c29516ebe54fec7108181\spring-boot-starter-json-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-tomcat\2.7.14\e203b8792f4bcfaa1d07956adb6dee7014a20881\spring-boot-starter-tomcat-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework\spring-webmvc\5.3.29\fdaefee29fcb8459aab748b571d8bb7bb7fdb175\spring-webmvc-5.3.29.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework\spring-web\5.3.29\4cd333e48d9a05d05c05ae7426242ecfe4cfb681\spring-web-5.3.29.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aop\5.3.29\397c588ce63ba4c185a8c1bd2f1e9139075b3bf1\spring-aop-5.3.29.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.aspectj\aspectjweaver\1.9.7\158f5c255cd3e4408e795b79f7c3fbae9b53b7ca\aspectjweaver-1.9.7.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\com.zaxxer\HikariCP\4.0.3\107cbdf0db6780a065f895ae9d8fbf3bb0e1c21f\HikariCP-4.0.3.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jdbc\5.3.29\25c0b36f780af98b2d3b554e9a6258ac599b6115\spring-jdbc-5.3.29.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.hibernate.common\hibernate-commons-annotations\5.1.2.Final\e59ffdbc6ad09eeb33507b39ffcf287679a498c8\hibernate-commons-annotations-5.1.2.Final.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.jboss.logging\jboss-logging\3.4.3.Final\c4bd7e12a745c0e7f6cf98c45cdcdf482fd827ea\jboss-logging-3.4.3.Final.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy\1.12.23\d470526e8c4566c04e9ae5d3ccb62d1a7aa58986\byte-buddy-1.12.23.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\antlr\antlr\2.7.7\83cd2cd674a217ade95a4bb83a8a14f351f48bd0\antlr-2.7.7.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.jboss\jandex\2.4.2.Final\1e1c385990b258ff1a24c801e84aebbacf70eb39\jandex-2.4.2.Final.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\com.fasterxml\classmate\1.5.1\3fe0bed568c62df5e89f4f174c101eab25345b6c\classmate-1.5.1.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\jaxb-runtime\2.3.8\c90a335a07c60db986f29d35b0f8ac0a18f0f989\jaxb-runtime-2.3.8.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework\spring-context\5.3.29\c374a72716d19220ca142efaab910adf5717c5d0\spring-context-5.3.29.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework\spring-orm\5.3.29\83953e2af9c1848227239b4695c7596a0f112da3\spring-orm-5.3.29.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-commons\2.7.14\c8c4825d930c9615bc7c9b42f433c9c14761fcaa\spring-data-commons-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework\spring-tx\5.3.29\dd26c6e31db036c3f96c24e8ff3b769a00dfc999\spring-tx-5.3.29.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework\spring-beans\5.3.29\be40f557f3fa52c703f00e127ff639f8cf499617\spring-beans-5.3.29.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework\spring-core\5.3.29\528eafe4cef7bccf3df290dd99ac5833a9756183\spring-core-5.3.29.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.36\6c62681a2f655b49963a5983b8b0950a6120ae14\slf4j-api-1.7.36.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\2.7.14\4851957607f74fc4335858d66fb755f1b0c95006\spring-boot-autoconfigure-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\2.7.14\762261093a3e15388216c45d6a9ba7fdc022b74d\spring-boot-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\2.7.14\ea9c060fd1e4d17cdd8a9ba3dec8076c17d22a23\spring-boot-starter-logging-2.7.14.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\1.3.5\59eb84ee0d616332ff44aba065f3888cf002cd2d\jakarta.annotation-api-1.3.5.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.30\8fde7fe2586328ac3c68db92045e1c8759125000\snakeyaml-1.30.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\jakarta.validation\jakarta.validation-api\2.0.2\5eacc6522521f7eacb081f95cee1e231648461e7\jakarta.validation-api-2.0.2.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.thymeleaf\thymeleaf\3.0.15.RELEASE\13e3296a03d8a597b734d832ed8656139bf9cdd8\thymeleaf-3.0.15.RELEASE.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.13.5\8ba3b868e81d7fc6ead686bd2353859b111d9eaf\jackson-datatype-jsr310-2.13.5.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.module\jackson-module-parameter-names\2.13.5\a401a99e7a45450fd3ef76e82ba39005fd1a8c22\jackson-module-parameter-names-2.13.5.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jdk8\2.13.5\1278f38160812811c56eb77f67213662ed1c7a2e\jackson-datatype-jdk8-2.13.5.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.13.5\aa95e46dbc32454f3983221d420e78ef19ddf844\jackson-databind-2.13.5.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-websocket\9.0.78\3d389e849edf92d5bc6a778a47428581773af3d6\tomcat-embed-websocket-9.0.78.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-core\9.0.78\ff73a2003d4b066b9affdc70827f6e8d282ab723\tomcat-embed-core-9.0.78.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework\spring-expression\5.3.29\44ac795a057c4a6360063801c54a2d148e5a2808\spring-expression-5.3.29.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\jakarta.xml.bind\jakarta.xml.bind-api\2.3.3\48e3b9cfc10752fba3521d6511f4165bea951801\jakarta.xml.bind-api-2.3.3.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\txw2\2.3.8\66e0297f1196f0d15a776e699de1b8e6ac5d44dd\txw2-2.3.8.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\com.sun.istack\istack-commons-runtime\3.0.12\cbbe1a62b0cc6c85972e99d52aaee350153dc530\istack-commons-runtime-3.0.12.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jcl\5.3.29\4f84fbeec60adb1a50734b6077836e53844f0134\spring-jcl-5.3.29.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.2.12\d4dee19148dccb177a0736eb2027bd195341da78\logback-classic-1.2.12.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.17.2\17dd0fae2747d9a28c67bc9534108823d2376b46\log4j-to-slf4j-2.17.2.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\1.7.36\ed46d81cef9c412a88caef405b58f93a678ff2ca\jul-to-slf4j-1.7.36.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.attoparser\attoparser\2.0.5.RELEASE\a93ad36df9560de3a5312c1d14f69d938099fa64\attoparser-2.0.5.RELEASE.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.unbescape\unbescape\1.1.6.RELEASE\7b90360afb2b860e09e8347112800d12c12b2a13\unbescape-1.1.6.RELEASE.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.13.5\136f77ab424f302c9e27230b4482e8000e142edf\jackson-annotations-2.13.5.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.13.5\d07c97d3de9ea658caf1ff1809fd9de930a286a\jackson-core-2.13.5.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.2.12\1d8e51a698b138065d73baefb4f94531faa323cb\logback-core-1.2.12.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.17.2\f42d6afa111b4dec5d2aea0fe2197240749a4ea6\log4j-api-2.17.2.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\com.h2database\h2\2.1.214\d5c2005c9e3279201e12d4776c948578b16bf8b2\h2-2.1.214.jar;C:\Users\민규\.gradle\caches\modules-2\files-2.1\com.sun.activation\jakarta.activation\1.2.2\74548703f9851017ce2f556066659438019e7eb5\jakarta.activation-1.2.2.jar" jpabook.jpashop.JpashopApplication. ____ _/\\ / ___'_ __ (_)_ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/ ___)| |_)| | | | | || (_| | ) ) ) )' |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot :: (v2.7.14)2023-08-16 15:16:35.129 INFO 6060 --- [ main] jpabook.jpashop.JpashopApplication : Starting JpashopApplication using Java 11.0.18 on DESKTOP-R06VPME with PID 6060 (C:\Users\민규\OneDrive\바탕 화면\Study\jpashop\out\production\classes started by 민규 in C:\Users\민규\OneDrive\바탕 화면\Study\jpashop)2023-08-16 15:16:35.136 INFO 6060 --- [ main] jpabook.jpashop.JpashopApplication : No active profile set, falling back to 1 default profile: "default"2023-08-16 15:16:36.872 INFO 6060 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.2023-08-16 15:16:36.903 INFO 6060 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 14 ms. Found 0 JPA repository interfaces.2023-08-16 15:16:38.080 INFO 6060 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)2023-08-16 15:16:38.094 INFO 6060 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]2023-08-16 15:16:38.094 INFO 6060 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.78]2023-08-16 15:16:38.273 INFO 6060 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext2023-08-16 15:16:38.273 INFO 6060 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2995 ms2023-08-16 15:16:38.545 INFO 6060 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]2023-08-16 15:16:38.624 INFO 6060 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.15.Final2023-08-16 15:16:38.916 INFO 6060 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}2023-08-16 15:16:39.035 INFO 6060 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...2023-08-16 15:16:39.190 INFO 6060 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.2023-08-16 15:16:39.228 INFO 6060 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect2023-08-16 15:16:39.542 ERROR 6060 --- [ main] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: jpabook.jpashop.domain.Order.member2023-08-16 15:16:39.543 WARN 6060 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: jpabook.jpashop.domain.Order.member2023-08-16 15:16:39.543 INFO 6060 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...2023-08-16 15:16:39.560 INFO 6060 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.2023-08-16 15:16:39.565 INFO 6060 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]2023-08-16 15:16:39.582 INFO 6060 --- [ main] ConditionEvaluationReportLoggingListener :Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.2023-08-16 15:16:39.615 ERROR 6060 --- [ main] o.s.boot.SpringApplication : Application run failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: jpabook.jpashop.domain.Order.memberat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.29.jar:5.3.29]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.29.jar:5.3.29]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.29.jar:5.3.29]at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.29.jar:5.3.29]at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.29.jar:5.3.29]at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.29.jar:5.3.29]at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.29.jar:5.3.29]at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1157) ~[spring-context-5.3.29.jar:5.3.29]at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:911) ~[spring-context-5.3.29.jar:5.3.29]at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.29.jar:5.3.29]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.14.jar:2.7.14]at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.14.jar:2.7.14]at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.14.jar:2.7.14]at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.14.jar:2.7.14]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.14.jar:2.7.14]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.14.jar:2.7.14]at jpabook.jpashop.JpashopApplication.main(JpashopApplication.java:11) ~[classes/:na]Caused by: org.hibernate.AnnotationException: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: jpabook.jpashop.domain.Order.memberat org.hibernate.cfg.annotations.CollectionBinder.getCollectionBinder(CollectionBinder.java:325) ~[hibernate-core-5.6.15.Final.jar:5.6.15.Final]at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1977) ~[hibernate-core-5.6.15.Final.jar:5.6.15.Final]at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:968) ~[hibernate-core-5.6.15.Final.jar:5.6.15.Final]at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:793) ~[hibernate-core-5.6.15.Final.jar:5.6.15.Final]at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:225) ~[hibernate-core-5.6.15.Final.jar:5.6.15.Final]at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:239) ~[hibernate-core-5.6.15.Final.jar:5.6.15.Final]at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:282) ~[hibernate-core-5.6.15.Final.jar:5.6.15.Final]at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460) ~[hibernate-core-5.6.15.Final.jar:5.6.15.Final]at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494) ~[hibernate-core-5.6.15.Final.jar:5.6.15.Final]at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.3.29.jar:5.3.29]at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.3.29.jar:5.3.29]at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-5.3.29.jar:5.3.29]at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-5.3.29.jar:5.3.29]at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.3.29.jar:5.3.29]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.29.jar:5.3.29]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.29.jar:5.3.29]... 16 common frames omittedProcess finished with exit code 1main메소드실행하면 이렇게 뜨고 종료 됩니다 h2 서버에 테이블도 안 만들어져요http://naver.me/x6ABJK1o <- domain 파일 주소
-
미해결자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
도서관 애플리케이션 실행 오류
도서관 애플리케이션을 실행하는 도중 아래와 같은 긴 오류가 떴습니다. 검색을 해도 잘 모르겠습니다 ㅠ어떻게 해야 할까요? Error executing DDL "drop table if exists user cascade " via JDBC StatementCaused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "drop table if exists [*]user cascade "; expected "identifier"; SQL statement:Error executing DDL "create table user (id bigint generated by default as identity, age integer, name varchar(20) not null, primary key (id))" via JDBC StatementCaused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "create table [*]user (id bigint generated by default as identity, age integer, name varchar(20) not null, primary key (id))"; expected "identifier"; SQL statement:Error executing DDL "alter table if exists user_loan_history add constraint FKa17jbf1po26eytdyvyj73b4rw foreign key (user_id) references user" via JDBC StatementCaused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "alter table if exists user_loan_history add constraint FKa17jbf1po26eytdyvyj73b4rw foreign key (user_id) references [*]user"; expected "identifier"; SQL statement:
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
실무에서 리퀴베이스나 플라이웨이를 사용하는지?
안녕하세요실무에서 db 스키마를 수정할때리퀴베이스를 사용하고 있습니다 그래서ddl-auto 를 이용하거나디비에서 직접 수정하는 방법은이력관리가 되지 않아서 지양하고관리 포인트를 리퀴베이스로만 하려고 하는데요어떤 방법은 좋은지 고민이 되네요 김영한님은 실무에서 어떤 기술로디비 스키마를 관리 하시는지 궁금합니다
-
미해결실전! Querydsl
Count 쿼리 최적화 관련 질문입니다.
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]안녕하세요. 강의 정말 잘 듣고있습니다! 대량의 데이터가 있는 상황에서 count 쿼리를 page가 바뀔 때 마다 날리는 것은 부담이 되는 것 같습니다.index를 적용하면 좋겠지만 전체 데이터에 대한 pagenation이라고 하면 index를 적용하기도 어려움이 있을 것 같습니다. 이런 경우에는 매일 특정 시간에 count 쿼리를 날려서 전체 개수를 캐시에 저장해두고 변경이 일어날 때마다 추가/삭제된 데이터의 개수를 +/- 해서 total count의 개수를 오차 없이 유지하는 방법을 생각 할 수 있을 것 같은데 제가 생각한 방식으로 캐시를 사용해도 괜찮을까요?
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
kafka 실행이 안됩니다.
zookeeper의 경우D:\{home}\kafka_2.13-2.7.0>bin\windows\zookeeper-server-start.bat config\zookeeper.properties이대로 실행하면 아래 파바박 뜨면서 tmp에 zookeeper 폴더도 잘 만들어 지는데kafka는D:\{home}\kafka_2.13-2.7.0>bin\windows\kafka-server-start.bat config\server.properties아무것도 안뜨고 그냥 D:\{home}\kafka_2.13-2.7.0>으로 넘어갑니다 tmp에 폴더도 안 만들어지고요. 딱히 에러가 발생하지도 않습니다. java는 jdk 11.0.2사용 중이고 버전에 문제 없어 보이는데 왜 이러는 걸까요?
-
해결됨실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화
13:50쯤부터 EAGER로 변경하고 나서 N+1 동작 질문있습니다
fetchtype을 LAZY로 설정했을 경우 N+1문제는 이해했습니다. 그런데 EAGER의 경우 Order를 위한 1개의 select쿼리 뒤에 delivery를 위한 1개의 쿼리와 3중 조인문 2개의 쿼리가 나가고 있는데 (위 사진) join문이 EAGER처리를 위한 쿼리라면 왜 order 조회쿼리 뒤에 바로 나가지 않고 delivery 조회쿼리가 한번 나간 뒤에 나가는건지 왜 delivery에 대한 추가 쿼리는 나가는데 member는 조회쿼리가 나가지 않고 join문이 나가는지 EAGER의 경우에도 모든 연관객체가 영속성 콘텍스트 안에 존재하지 않는다면 정확히 1+N개의 쿼리가 나가는지 (=LAZY와 똑같이 1+N개의 쿼리가 나가는지) 이 세가지가 이해되지 않습니다.EAGER일때 쿼리를 이해해보려고 노력했는데 "LAZY와는 추가쿼리(N)가 나가는 시점의 차이가 있다" 정도 말고는 이해가 되지 않아 질문드립니다.
-
미해결자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
LibraryAppApplication.java 컴파일 시 에러가 뜹니다.
No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.2 was found. The consumer was configured to find a library for use during runtime, compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.2.1' but: 현재 SDK는 11 Oracle, Language level은 11- local variable syntax for lambda parameters로 되어있습니다. 원래는 컴파일이 됐었는데 1번 강의(스프링 프로젝트를 시작하는 두 번째 방법) 이후 안되는 것 같습니다. 어떻게 해야할까요?
-
미해결실전! Querydsl
hello unittest에러
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]여기에 질문 내용을 남겨주세요.QueryDlsApplicationTest.java를 실행하면,org.hibernate.exception.SQLGrammarException: could not prepare statement [Sequence "HELLO_SEQ" not found; SQL statement:select next value for hello_seq [90036-214]] [select next value for hello_seq]at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:64)at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:56)at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108)at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:187)at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:76)at org.hibernate.id.enhanced.SequenceStructure$1.getNextValue(SequenceStructure.java:100)at org.hibernate.id.enhanced.PooledOptimizer.generate(PooledOptimizer.java:72)at org.hibernate.id.enhanced.SequenceStyleGenerator.generate(SequenceStyleGenerator.java:542)at org.hibernate.id.IdentifierGenerator.generate(IdentifierGenerator.java:147)at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:120)at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:175)at org.hibernate.event.internal.DefaultPersistEventListener.persist(DefaultPersistEventListener.java:93)at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:77)at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:54)at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:755)at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:739)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.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:311)at jdk.proxy2/jdk.proxy2.$Proxy108.persist(Unknown Source)at study.querydsl.QuerydslApplicationTests.contextLoads(QuerydslApplicationTests.java:25)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:232)at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Sequence "HELLO_SEQ" not found; SQL statement:select next value for hello_seq [90036-214]at org.h2.message.DbException.getJdbcSQLException(DbException.java:632)at org.h2.message.DbException.getJdbcSQLException(DbException.java:477)at org.h2.message.DbException.get(DbException.java:223)at org.h2.message.DbException.get(DbException.java:199)at org.h2.command.Parser.readSequence(Parser.java:8471)at org.h2.command.Parser.readTermWithIdentifier(Parser.java:5347)at org.h2.command.Parser.readTermWithIdentifier(Parser.java:5217)at org.h2.command.Parser.readTerm(Parser.java:4901)at org.h2.command.Parser.readFactor(Parser.java:3398)at org.h2.command.Parser.readSum(Parser.java:3385)at org.h2.command.Parser.readConcat(Parser.java:3350)at org.h2.command.Parser.readCondition(Parser.java:3132)at org.h2.command.Parser.readExpression(Parser.java:3053)at org.h2.command.Parser.parseSelectExpressions(Parser.java:2853)at org.h2.command.Parser.parseSelect(Parser.java:2871)at org.h2.command.Parser.parseQueryPrimary(Parser.java:2762)at org.h2.command.Parser.parseQueryTerm(Parser.java:2633)at org.h2.command.Parser.parseQueryExpressionBody(Parser.java:2612)at org.h2.command.Parser.parseQueryExpressionBodyAndEndOfQuery(Parser.java:2605)at org.h2.command.Parser.parseQueryExpression(Parser.java:2598)at org.h2.command.Parser.parseQuery(Parser.java:2567)at org.h2.command.Parser.parsePrepared(Parser.java:724)at org.h2.command.Parser.parse(Parser.java:689)at org.h2.command.Parser.parse(Parser.java:661)at org.h2.command.Parser.prepareCommand(Parser.java:569)at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:631)at org.h2.server.TcpServerThread.process(TcpServerThread.java:288)at org.h2.server.TcpServerThread.run(TcpServerThread.java:191)at java.base/java.lang.Thread.run(Thread.java:834)at org.h2.message.DbException.getJdbcSQLException(DbException.java:632)at org.h2.engine.SessionRemote.readException(SessionRemote.java:637)at org.h2.engine.SessionRemote.done(SessionRemote.java:606)at org.h2.command.CommandRemote.prepare(CommandRemote.java:78)at org.h2.command.CommandRemote.<init>(CommandRemote.java:50)at org.h2.engine.SessionRemote.prepareCommand(SessionRemote.java:480)at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1116)at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:92)at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:288)at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:327)at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)at com.p6spy.engine.wrapper.ConnectionWrapper.prepareStatement(ConnectionWrapper.java:118)at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$1.doPrepare(StatementPreparerImpl.java:91)at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:177)... 90 more에러가 납니다. QuerydlsApplicationTests.java는 이렇습니다.ackage study.querydsl;import com.querydsl.jpa.impl.JPAQueryFactory;import jakarta.persistence.EntityManager;import jakarta.transaction.Transactional;import org.assertj.core.api.Assertions;import org.junit.jupiter.api.Test;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.test.context.SpringBootTest;import study.querydsl.entity.Hello;import study.querydsl.entity.QHello;import static org.assertj.core.api.Assertions.*;@SpringBootTest@Transactionalclass QuerydslApplicationTests {@AutowiredEntityManager em;@Testvoid contextLoads() {Hello hello = new Hello();em.persist(hello);JPAQueryFactory query = new JPAQueryFactory(em);QHello qHello = new QHello("h");Hello result = query.selectFrom(qHello).fetchOne();assertThat(result).isEqualTo(hello);assertThat(result.getId()).isEqualTo(hello.getId());}}hello.java 입니다package study.querydsl.entity;import jakarta.persistence.Entity;import jakarta.persistence.GeneratedValue;import jakarta.persistence.Id;import lombok.Getter;import lombok.Setter;@Entity@Getter @Setterpublic class Hello {@Id @GeneratedValue private Long id;}어떻게 해야 하나요?
-
해결됨자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
도서관앱 포트번호 변경
도서관앱의 포트번호가 8080으로 설정되어 있는것 같은데 포트번호를 변경하는 방법을 모르겠습니다..ㅠ