묻고 답해요
160만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨스프링부트 시큐리티 & JWT 강의
Google Cloud 에 OAuth 테스트 프로젝트를 만들게 되면, 비용이 발생하는지 궁금합니다.
안녕하세요 OAuth Google 강의를 진행하려고 하는데, 문의 사항이 있습니다. Google Cloud 에 테스트 프로젝트를 만들게 되면, 비용이 발생하는지 궁금합니다. 제가 Google Cloud 사용 경험이 없어서 문의를 드립니다.
-
미해결따라하며 배우는 NestJS
ERROR [ExceptionHandler] No repository for "BoardRepository" was found.
안녕하세요. 데이터베이스를 이용한 CRUD 구현 > 게시물 생성하기 를 들으면서 service와 controller 코드를 고치고 npm run start:dev 실행을 하니 아래와 같은 오류가 뜹니다. 똑같이 코드를 보며 하고있는데 아래와 같은 오류가 뜨는 이유를 알 수 있을까요?? ERROR [ExceptionHandler] No repository for "BoardRepository" was found. Looks like this entity is not registered in current "default" connection? RepositoryNotFoundError: No repository for "BoardRepository" was found. Looks like this entity is not registered in current "default" connection? at RepositoryNotFoundError.TypeORMError [as constructor] (/Users/Desktop/nestjs_crud/src/error/TypeORMError.ts:7:9) at new RepositoryNotFoundError (/Users/Desktop/nestjs_crud/src/error/RepositoryNotFoundError.ts:10:9) at EntityManager.getRepository (/Users/Desktop/nestjs_crud/src/entity-manager/EntityManager.ts:964:19)
-
미해결스프링부트 시큐리티 & JWT 강의
스프링 시큐리티 Websecurityconfigureradapter deprecated 문제 해결!! 최신 코드 반영 해두었습니다
스프링시큐리티 Websecurityconfigureradapter deprecated 문제로 코드 수정해서 새로운 브랜치에 올려두었습니다. https://github.com/codingspecialist/Springboot-Security-JWT-Easy/tree/version2
-
미해결따라하며 배우는 NestJS
BoardsController 못불러와요 ㅜ_ㅜ
안녕하세요, controller까지 작성하고 npm run start:dev로 테스트시 빈배열을 못불러오고 {"statusCode":404,"message":"Cannot GET /boards","error":"Not Found"} 통신이 안되네요 ㅜ_ㅜ 터미널을 보니, 모듈까지 불러오고 컨트롤러는 못불러옵니다ㅜㅜ MAPPED{/borads, GET} route도 못불러오구요.. 그냥 모듈까지 불러오고 스타트가 되는데 어떻게 해야할까요 ㅜㅜ?
-
해결됨Spring Boot JWT Tutorial
USER 테이블 생성이 안됩니다.
AUTHORITY, USER_AUTHORITY 테이블은 제대로 생성이 되는데, USER 테이블만 생성이 되지 않습니다.
-
해결됨Spring Boot JWT Tutorial
AuthController관련 문의 드려요!
AuthController에서 38번 행의authenticationManagerBuilder.getObject().authenticate(authenticationToken); 을 진행했을 때 CustomUserDetailsService의 loadUserByUsername가 실행된다고 했는데, 호출하지 않았는데 어떻게 실행되는건가요?? ㅠㅠ
-
미해결탄탄한 백엔드 NestJS, 기초부터 심화까지
JWT_SECRET 관련 질문입니다.
안녕하세요. 좋은 강의 잘 듣고 있습니다. 영상 2분 2초 경에 보면 .env파일에 JWT_SECRET 값을 설정해주시는데 그 값은 임의로 생성하신 건지 아니면 생성하는 규칙이 따로 있는건지 궁금합니다.
-
미해결따라하며 배우는 NestJS
jwt 토큰 생성중에 질문있습니다
안녕하세요. 이렇게 질 좋은 강의를 무료로 열어주신 것에 먼저 감사드립니다. 제가 아직 잘 못따라가서인지 모르겠지만 현재 controller, service, repository 세부분을 나누어서 역할을 구분짓고 있습니다 controller에선 엔드포인트 설정해주고 service에선 목적에 맞게 값을 리턴해서 controller에 올려주고 repository에선 DB와 교환이 발생하는 부분은 여기서 관리하고 있습니다 영상에서는 service에서 토큰을 생성후에 객체안에 담아서 accessToken을 넣어주고 있습니다 하지만 저는 repository에서 토큰을 생성후에 토큰을 담아주고 싶은데 Cannot read properties of undefined (reading 'sign') 오류가 나옵니다 구글링을 해보았지만 모듈에 있는 import부분을 건드리라는 말밖에 없는것 같아 질문을 드립니다 현재 제가 작성한 코드는 영상과 전부 같게 작성했고 단지 jwtService:JwtService 선언한 부분만 추가해 주었습니다 왜 sign부분을 읽지 못하는걸까요..? 너무 궁금합니다 * 영상대로 진행하면 제대로 토큰값을 반환합니다! * import { ConflictException, InternalServerErrorException, NotFoundException, UnauthorizedException } from "@nestjs/common"; import { EntityRepository, Repository } from "typeorm"; import { CreateUserDto, UserLoginDto } from "./dto/user.dto"; import { UserStatus } from "./user-status-validation"; import { User } from "./user.entity"; import * as bcrypt from 'bcryptjs' import { JwtService } from "@nestjs/jwt"; @EntityRepository(User) export class UserRepository extends Repository<User> { private jwtService: JwtService; async signIn(userLoginDto:UserLoginDto): Promise<{accessToken:string}>{ const { userid, password } = userLoginDto const user = await this.findOne({ userid }) if(user && (await bcrypt.compare(password, user.password ))){ const payload={userid} const accessToken= await this.jwtService.sign(payload) return {accessToken:accessToken} } else { throw new UnauthorizedException('login failed') } } }
-
미해결스프링부트 시큐리티 & JWT 강의
20초가량에 csrf 를 disable 한 이유가 뭔가요?
이전 수업을 들었으면 알 거라고 하는데 어디에 나와있을까요? 1강에서도 그냥 말없이 disable만 하셔서 질문 남겼는데 여기서도 그냥 넘어가서 제가 빼먹은 부분이 있나 싶어서요
-
미해결스프링부트 시큐리티 & JWT 강의
08:08 시점에 csrf disable 한 이유가 뭔가요?
08:08 시점에 csrf disable 한 이유가 뭔가요? csrf가 기본적으로 켜져 있는건 알겠는데 굳이 disable한 이유가 있나요?
-
미해결따라하며 배우는 NestJS
findOne(id) 에서 에러가 발생한 경우 해결법
# Info 강의 업로드 연도(2021) 와 수강 연도(2022) 사이에 TypeORM 의 버전이 달라서, Repository.findOne() 메서드의 구성이 달라진 것 같다고 생각합니다.강의 대로 코드를 작성하면 후술할 에러가 발생하는데, 해당 부분을 해결하고 나서, 다른 수강생 분들 도 이런 문제를 겪을까 생각되어서 따로 글로 남기게 되었습니다. ## 문제 세 줄 요약 1. fineOne( id) 를 하면 에러가 발생 2. 관련 레퍼런스가 없어서 TypeORM docs 확인 3. fineOneBy({id}) 로 에러 해결 (2022-03-30) 자세한 내용은 ### 해결방법, ### 참고문서, ### 초기질문 참고해주세요.깃 : unchaptered/22-03-nestjs-board: Nest.JS (github.com) ### 해결방법 2022년 3월 30일 기준으로, this.boardsRepository.findOne( id ); 위와 같이 입력을 했는데 에러가 발생했다면, 해당 부분을 다음의 코드로 교체해서 해결할 수 있습니다. this.boardsRepository.fineOneBy({ id }); ### 참고문서 아래 페이지에서 Ctrl + F 로 fineOne 혹은 fineOneBy 를 검색해서 확인하시면 됩니다.TypeORM - Amazing ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms. ### 초기 질문 boards.service.ts 의 getBoardById() 에서 this.boardsRepository.fineOne(id); 를 하면 id 에 붉은 경고가 다음과 같이 발생하고 있습니다. 혹시 해당 부분이 왜 문제가 되는지 알 수 있을까요? 정크 데이터까지만 푸쉬 해놓았지만, node_module 버전 문제일까 싶어서 깃 허브 링크도 최하단에 올려놓겠습니다. 위의 에러가 발생하는 해당 코드입니다. async getBoardById(id: number): Promise<Board> { const found = await this.boardsRepository.findOne(id); if (!found) throw new NotFoundException(`Can't find Board by ${id}`); return found; } 엔티티 import { BaseEntity, Column, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm"; import { BoardStatus } from "./board-status.enum"; export class Board extends BaseEntity { @PrimaryGeneratedColumn() id: number; @Column() title: string; @Column() description: string; @Column() status: BoardStatus; } baords.repository.ts import { EntityRepository, Repository } from "typeorm"; import { Board } from "./entity/board.entity"; @EntityRepository(Board) export class BoardsRepository extends Repository<Board> { } 깃허브 : unchaptered/22-03-nestjs-board: Nest.JS (github.com)
-
미해결탄탄한 백엔드 NestJS, 기초부터 심화까지
JWT와 로그인 서비스 & 순환 참조 모듈 질문드립니다
안녕하세요 강사님 수업에서 공식문서 Request LifeCyle을 보았을때 미들웨어 다음에 Guard가 실행된다고 공식문서에 적혀져있습니다. 그렇다면 수업와 같이 이 사진에서 AuthGuard에 파라미터 ('jwt')을 넘겨주면서 상속을 받았다고 생각하는데 그렇다면 JwtAuthGuard 라는 클래스의 인스턴스를 어디서 누가 실행하는건가요? 주입받는곳이 따로 없어서 내부적으로 어떻게돌아가는지 그리고 파라미터 ('jwt')의 역할에대해서 질문드립니다 부족한 설명 죄송합니다ㅠㅠ 감사합니다.
-
미해결스프링부트 시큐리티 & JWT 강의
BycryptPasswordEncoder 주입시 순화참조 문제
저는 mac m1버전 인텔리제이 spring boot 2.64 버전 java8 로 하고있습니다. 저도 13:41 BycryptPasswordEncoder를 주입하니 SecurityConfig와 순환참조가 걸려 진행이 되지 않았습니다. 그래서 PrincipalOauth2UserService에서 private BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(); 이렇게 생성하여서 진행하였습니다. 혹시 강의를 보시는 다른 분들을 위해 참고 코드를 남겼습니다.
-
미해결Spring Boot JWT Tutorial
data.sql 파일 실행이 안됩니다
application.yml spring: h2: console: enabled: true datasource: url: jdbc:h2:mem:testdb driver-class-name: org.h2.Driver username: sa password: initialization-mode: never jpa: database-platform: org.hibernate.dialect.H2Dialect hibernate: ddl-auto: none properties: hibernate: format_sql: true show_sql: true defer-datasource-initialization: true sql: init: mode: alwaysjwt: header: Authorization secret: c2lsdmVybmluZS10ZWNoLXNwcmluZy1ib290LWp3dC10dXRvcmlhbC1zZWNyZXQtc2lsdmVybmluZS10ZWNoLXNwcmluZy1ib290LWp3dC10dXRvcmlhbC1zZWNyZXQK token-validity-in-seconds: 86400logging: level: me.silvernine: DEBUG 인터넷 찾아 보면서 위 내용으로 수정 했는데도 실행이 될 때 data.sql 의 쿼리가 동작 하지 않습니다.
-
미해결스프링부트 시큐리티 & JWT 강의
chain 부분
chain.dofFilter 부분이 이해가 잘안가서 그런데 우리가 만든 필터를 FilterChainProxy에 넣어준다는 의미로 봐도 무방할까요?? 정확히 무슨 역활을 하는 부분인가요??
-
해결됨Spring Boot JWT Tutorial
6:46에 설명란이 어디죠...
6:46에 설명란이 어디죠..... 복붙해서 사용해 보려고 했는데 어딜봐도 링크를 못찾겟습니다...
-
해결됨Spring Boot JWT Tutorial
블로그 작성
안녕하세요. 은구님! 일단 너무나 훌륭한 강의를 만들어주셔서 정말 감사합니다. jwt 강의를 올려주신 덕분에 참고해서 개인토이프로젝트에 적용중인데요! 혹시 강의해주신 내용을 참고해서 블로그에 글을 작성해도 될까요 ??? 출처는 꼭 남기겠습니다!
-
해결됨Spring Boot JWT Tutorial
포스트맨 결과 500 서버 에러 뜨시는 분!
application.yml 에서 jwt.secret 값이 64바이트 이상이여야 합니다...
-
미해결파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트
JWT_REFRESH_EXPIRATION_DELTA의 설명이 혹시 잘못된것 아닌가요?
해당 강의 마지막에서, refresh 를 받으면 refresh 타임도 새로 할당 받는다고 설명하신것 같은데.refresh 타임은 최초 발급된 토큰기준으로 생성된 고정된 값이 아닌가요? 'JWT_REFRESH_EXPIRATION_DELTA' : datetime.timedelta(days=7) 의 의미는 최초 토큰 발급일 이후 7일 동안 refresh 가 가능하다라는 의미인거 같은데 제가 잘못 이해한것인가요?
-
미해결Spring Boot JWT Tutorial
org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [FKASNMJAR8JR5GAXVD7966P19IR]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
안녕하세요? 이 강의를 보고, 이 강의를 토대로 토이 프로젝트를 진행하고 있습니다. 근데 계속 아래와 같은 Exception이 터지고 있습니다. 다수 회원을 생성 합니다! Hibernate: insert into member (member_id, modify_date, register_date, about_me, activated, email, name, nickname, password, phone) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: insert into member_authority (member_id, authority_name) values (?, ?) 2022-02-09 23:42:57.821 WARN 11871 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 23506, SQLState: 23506 2022-02-09 23:42:57.821 ERROR 11871 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : Referential integrity constraint violation: "FKASNMJAR8JR5GAXVD7966P19IR: PUBLIC.MEMBER_AUTHORITY FOREIGN KEY(AUTHORITY_NAME) REFERENCES PUBLIC.AUTHORITY(AUTHORITY_NAME) ('ROLE_FAMILY')"; SQL statement: insert into member_authority (member_id, authority_name) values (?, ?) [23506-200] 2022-02-09 23:42:57.823 INFO 11871 --- [ main] o.h.e.j.b.internal.AbstractBatchImpl : HHH000010: On release of batch it still contained JDBC statements org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [FKASNMJAR8JR5GAXVD7966P19IR]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:276) at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:233) at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:566) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:743) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:711) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:654) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:407) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:174) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at com.sun.proxy.$Proxy142.save(Unknown Source) at org.comunity.hongga.repository.MemberRepositoryTest.lambda$회원_100명_생성_상세_조회$0(MemberRepositoryTest.java:76) at java.base/java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104) at java.base/java.util.stream.IntPipeline$Head.forEach(IntPipeline.java:593) at org.comunity.hongga.repository.MemberRepositoryTest.회원_100명_생성_상세_조회(MemberRepositoryTest.java:57) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725) 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:149) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84) at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115) at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105) 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.ExecutableInvoker.invoke(ExecutableInvoker.java:104) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66) 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:1541) 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:1541) 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:107) 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: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:71) 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.hibernate.exception.ConstraintViolationException: could not execute statement at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:59) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:37) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:200) at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:46) at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:1352) at org.hibernate.action.internal.CollectionRecreateAction.execute(CollectionRecreateAction.java:50) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604) at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478) at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:344) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:40) at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107) at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1402) at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:493) at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3285) at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2420) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:449) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:183) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$300(JdbcResourceLocalTransactionCoordinatorImpl.java:40) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:281) at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:101) at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:562) ... 87 more Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Referential integrity constraint violation: "FKASNMJAR8JR5GAXVD7966P19IR: PUBLIC.MEMBER_AUTHORITY FOREIGN KEY(AUTHORITY_NAME) REFERENCES PUBLIC.AUTHORITY(AUTHORITY_NAME) ('ROLE_FAMILY')"; SQL statement: insert into member_authority (member_id, authority_name) values (?, ?) [23506-204] at org.h2.message.DbException.getJdbcSQLException(DbException.java:527) at org.h2.message.DbException.getJdbcSQLException(DbException.java:496) at org.h2.message.DbException.get(DbException.java:227) at org.h2.message.DbException.get(DbException.java:203) at org.h2.constraint.ConstraintReferential.checkRowOwnTable(ConstraintReferential.java:311) at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:252) at org.h2.table.Table.fireConstraints(Table.java:1163) at org.h2.table.Table.fireAfterRow(Table.java:1181) at org.h2.command.dml.Insert.insertRows(Insert.java:188) at org.h2.command.dml.Insert.update(Insert.java:135) at org.h2.command.dml.DataChangeStatement.update(DataChangeStatement.java:61) at org.h2.command.CommandContainer.update(CommandContainer.java:173) at org.h2.command.Command.executeUpdate(Command.java:252) at org.h2.server.TcpServerThread.process(TcpServerThread.java:408) at org.h2.server.TcpServerThread.run(TcpServerThread.java:191) at java.base/java.lang.Thread.run(Thread.java:831) at org.h2.message.DbException.getJdbcSQLException(DbException.java:459) at org.h2.engine.SessionRemote.done(SessionRemote.java:611) at org.h2.command.CommandRemote.executeUpdate(CommandRemote.java:237) at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:191) at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:152) at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197) ... 107 more @Test public void 회원_100명_생성_상세_조회() { // given System.out.println("다수 회원을 생성 합니다!"); // 50번까지 FAMILY // 100번까지 GUEST IntStream.rangeClosed(1, 100).forEach(i -> { if (i <= 50) { Authority authority = Authority.builder() .authorityName("ROLE_FAMILY") .build(); Member memberMany = Member.builder() .email("whoami"+i+"@hongga.com") .password(passwordEncoder.encode("1234")) .name("손님" + i) .nickname("손님이에영" + i) .phoneNumber("010-3948-4934") .activated(true) .authorities(Collections.singleton(authority)) .build(); // when Member saveManyFamily = memberRepository.save(memberMany); // then System.out.println(assertThat(memberMany).isEqualTo(saveManyFamily)); } else { Authority authority = Authority.builder() .authorityName("ROLE_GUEST") .build(); Member memberMany = Member.builder() .email("whoami"+i+"@hongga.com") .password(passwordEncoder.encode("1234")) .name("손님" + i) .nickname("손님이에영" + i) .phoneNumber("010-3948-4934") .activated(true) .authorities(Collections.singleton(authority)) .build(); // when Member saveManyGuest = memberRepository.save(memberMany); // then System.out.println(assertThat(memberMany).isEqualTo(saveManyGuest)); } // if-else 끝 }); System.out.println("==============================================================="); System.out.println("회원 조회를 시작 합니다!"); //given IntStream.rangeClosed(1, 100).forEach(i -> { String email = "whoami"+i+"@hongga.com"; // when Member byEmail = memberRepository.findByEmail(email); // then System.out.println(assertThat(email).isEqualTo(byEmail)); });} // 회원_상세_조회() 끝 이렇게 TEST 코드를 작성해서 여러 회원을 검색하고, 비교 해 보려고 하는데 안 됩니다. 의심 가는 건 저는 회원 등급을 GUEST, FAMILY, ADMIN으로 사용하고 싶은데, 혹시 이걸 Check하거나 뭐 그러는 곳이 있나요?? 조언 부탁 드리겠습니다! https://github.com/junyharang-personal-project/hongga-community-server