묻고 답해요
158만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결승리하는 제안서
강의자료를 찾기가 힘든데요, 강의자료 어디서 받을 수 있을까요?
먼저 좋은 강의 잘 들었습니다. 강의해주신 내용 참고해서 성공적인 제안 할 수 있도록 노력하겠습니다! 강의자료를 찾기가 힘든데요, 강의자료 어디서 받을 수 있을까요?
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 챗봇 사이트 만들기
npm start 에러
npm ERR! code 1npm ERR! path C:\Users\gjaischool\Desktop\x_test\chatbot-app-master\node_modules\grpcnpm ERR! command failednpm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build --library=static_librarynpm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\Users\gjaischool\Desktop\x_test\chatbot-app-master\node_modules\grpc\src\node\extension_binary\node-v115-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\gjaischool\Desktop\x_test\chatbot-app-master\node_modules\grpc\src\node\extension_binary\node-v115-win32-x64-unknown --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)npm ERR! node-pre-gyp info it worked if it ends with oknpm ERR! node-pre-gyp info using node-pre-gyp@0.12.0npm ERR! node-pre-gyp info using node@20.4.0 | win32 | x64npm ERR! node-pre-gyp WARN Using needle for node-pre-gyp https downloadnpm ERR! node-pre-gyp info check checked for "C:\Users\gjaischool\Desktop\x_test\chatbot-app-master\node_modules\grpc\src\node\extension_binary\node-v115-win32-x64-unknown\grpc_node.node" (not found)npm ERR! node-pre-gyp http GET https://node-precompiled-binaries.grpc.io/grpc/v1.19.0/node-v115-win32-x64-unknown.tar.gznpm ERR! node-pre-gyp http 404 https://node-precompiled-binaries.grpc.io/grpc/v1.19.0/node-v115-win32-x64-unknown.tar.gznpm ERR! node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.19.0/node-v115-win32-x64-unknown.tar.gznpm ERR! node-pre-gyp WARN Pre-built binaries not found for grpc@1.19.0 and node@20.4.0 (node-v115 ABI, unknown) (falling back to source compile with node-gyp) npm ERR! node-pre-gyp http 404 status code downloading tarball https://node-precompiled-binaries.grpc.io/grpc/v1.19.0/node-v115-win32-x64-unknown.tar.gznpm ERR! gyp info it worked if it ends with oknpm ERR! gyp info using node-gyp@9.4.0npm ERR! gyp info using node@20.4.0 | win32 | x64npm ERR! gyp info oknpm ERR! gyp info it worked if it ends with oknpm ERR! gyp info using node-gyp@9.4.0npm ERR! gyp info using node@20.4.0 | win32 | x64npm ERR! gyp ERR! find Pythonnpm ERR! gyp ERR! find Python Python is not set from command line or npm configurationnpm ERR! gyp ERR! find Python Python is not set from environment variable PYTHONnpm ERR! gyp ERR! find Python checking if "python3" can be usednpm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an errornpm ERR! gyp ERR! find Python checking if "python" can be usednpm ERR! gyp ERR! find Python - "python" is not in PATH or produced an errornpm ERR! gyp ERR! find Python checking if Python is C:\Users\gjaischool\AppData\Local\Programs\Python\Python39\python.exenpm ERR! gyp ERR! find Python - "C:\Users\gjaischool\AppData\Local\Programs\Python\Python39\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exenpm ERR! gyp ERR! find Python - "C:\Program Files\Python39\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Users\gjaischool\AppData\Local\Programs\Python\Python39-32\python.exenpm ERR! gyp ERR! find Python - "C:\Users\gjaischool\AppData\Local\Programs\Python\Python39-32\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exenpm ERR! gyp ERR! find Python - "C:\Program Files\Python39-32\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exenpm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python39-32\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Users\gjaischool\AppData\Local\Programs\Python\Python38\python.exenpm ERR! gyp ERR! find Python - "C:\Users\gjaischool\AppData\Local\Programs\Python\Python38\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exenpm ERR! gyp ERR! find Python - "C:\Program Files\Python38\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Users\gjaischool\AppData\Local\Programs\Python\Python38-32\python.exenpm ERR! gyp ERR! find Python - "C:\Users\gjaischool\AppData\Local\Programs\Python\Python38-32\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exenpm ERR! gyp ERR! find Python - "C:\Program Files\Python38-32\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exenpm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python38-32\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Users\gjaischool\AppData\Local\Programs\Python\Python37\python.exenpm ERR! gyp ERR! find Python - "C:\Users\gjaischool\AppData\Local\Programs\Python\Python37\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python37\python.exenpm ERR! gyp ERR! find Python - "C:\Program Files\Python37\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Users\gjaischool\AppData\Local\Programs\Python\Python37-32\python.exenpm ERR! gyp ERR! find Python - "C:\Users\gjaischool\AppData\Local\Programs\Python\Python37-32\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python37-32\python.exenpm ERR! gyp ERR! find Python - "C:\Program Files\Python37-32\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python37-32\python.exenpm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python37-32\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Users\gjaischool\AppData\Local\Programs\Python\Python36\python.exenpm ERR! gyp ERR! find Python - "C:\Users\gjaischool\AppData\Local\Programs\Python\Python36\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python36\python.exenpm ERR! gyp ERR! find Python - "C:\Program Files\Python36\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Users\gjaischool\AppData\Local\Programs\Python\Python36-32\python.exenpm ERR! gyp ERR! find Python - "C:\Users\gjaischool\AppData\Local\Programs\Python\Python36-32\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python36-32\python.exenpm ERR! gyp ERR! find Python - "C:\Program Files\Python36-32\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python36-32\python.exenpm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python36-32\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if the py launcher can be used to find Python 3npm ERR! gyp ERR! find Python - "py.exe" is not in PATH or produced an errornpm ERR! gyp ERR! find Pythonnpm ERR! gyp ERR! find Python **********************************************************npm ERR! gyp ERR! find Python You need to install the latest version of Python.npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,npm ERR! gyp ERR! find Python you can try one of the following options:npm ERR! gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm)npm ERR! gyp ERR! find Python - Set the environment variable PYTHONnpm ERR! gyp ERR! find Python - Set the npm configuration variable python:npm ERR! gyp ERR! find Python npm config set python "C:\Path\To\python.exe"npm ERR! gyp ERR! find Python For more information consult the documentation at:npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installationnpm ERR! gyp ERR! find Python **********************************************************npm ERR! gyp ERR! find Pythonnpm ERR! gyp ERR! configure errornpm ERR! gyp ERR! stack Error: Could not find any Python installation to usenpm ERR! gyp ERR! stack at PythonFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:330:47)npm ERR! gyp ERR! stack at PythonFinder.runChecks (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:159:21)npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:228:18)npm ERR! gyp ERR! stack at PythonFinder.execFileCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:294:16)npm ERR! gyp ERR! stack at exithandler (node:child_process:427:5)npm ERR! gyp ERR! stack at ChildProcess.errorhandler (node:child_process:439:5)npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:512:28)npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:483:16)npm ERR! gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:82:21)npm ERR! gyp ERR! System Windows_NT 10.0.22621npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=C:\\Users\\gjaischool\\Desktop\\x_test\\chatbot-app-master\\node_modules\\grpc\\src\\node\\extension_binary\\node-v115-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--module_path=C:\\Users\\gjaischool\\Desktop\\x_test\\chatbot-app-master\\node_modules\\grpc\\src\\node\\extension_binary\\node-v115-win32-x64-unknown" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v115"npm ERR! gyp ERR! cwd C:\Users\gjaischool\Desktop\x_test\chatbot-app-master\node_modules\grpcnpm ERR! gyp ERR! node -v v20.4.0npm ERR! gyp ERR! node-gyp -v v9.4.0npm ERR! gyp ERR! not oknpm ERR! node-pre-gyp ERR! build errornpm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\Users\gjaischool\Desktop\x_test\chatbot-app-master\node_modules\grpc\src\node\extension_binary\node-v115-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\gjaischool\Desktop\x_test\chatbot-app-master\node_modules\grpc\src\node\extension_binary\node-v115-win32-x64-unknown --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\gjaischool\Desktop\x_test\chatbot-app-master\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:512:28)npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1098:16)npm ERR! node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:304:5)npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.22621npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\gjaischool\\Desktop\\x_test\\chatbot-app-master\\node_modules\\grpc\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"npm ERR! node-pre-gyp ERR! cwd C:\Users\gjaischool\Desktop\x_test\chatbot-app-master\node_modules\grpcnpm ERR! node-pre-gyp ERR! node -v v20.4.0npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.12.0npm ERR! node-pre-gyp ERR! not oknpm ERR! A complete log of this run can be found in: C:\Users\gjaischool\AppData\Local\npm-cache\_logs\2023-10-05T05_36_46_355Z-debug-0.log 이런식으로 오류가 계속납니다 .. 버전을 다운해서 받아도 나고 업그레이드 해도 나고 제발 알려주세요 ㅠㅠ
-
해결됨손에 익는 Next.js - 공식 문서 훑어보기
다음 영상에서는 메뉴좀 크게보이게 해주세요.
노트북에서 보면 프로젝트 디렉토리 폴더/파일들이 너무 작아서 안보이네요.
-
미해결홍정모의 따라하며 배우는 C언어
정수 질문
3.5 정수와 실수 12:09 화면 캡처 질문입니다 각 칸에 0과 1이 들어가야 되는 이유랑 왜 0101 1110인지 궁금합니다 어떤건 0이고 어떤건 1인데 어떻게 구분하는건가요?
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
3-D 왜 틀렸을까요?
알려주시면 감사드립니다 ㅠㅠhttp://boj.kr/55889bf2310f490a82888d282c975425
-
미해결스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술
thymeleaf 질문
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]th:href="@{|/basic/items/${item.id}|}" th:href="@{/basic/items/${item.id}}"1번 구문과 2번구문의 차이는 ||로 감싸주냐 마냐의 차이인데 같은 결과 , 같은 동작을 하네요이 경우에는 ||로 감싸줄 필요가없는건가요 아니면 인텔리제이에서 알아서 감지해서 ||로 자동으로 감싸준 결과로 실행을 해주는걸까요 ?
-
미해결GA4 필수 코스 (by 현직 실리콘밸리 마케팅 디렉터)
3강 쳅터요약에서 추천해준 웹 기술이 강의하단에 있다고 하셨는데 어디있는지 못 찾겠습니다.
3강 쳅터요약에서 추천해준 웹 기술이 강의하단에 있다고 하셨는데 어디있는지 못 찾겠습니다.
-
해결됨곰책으로 쉽게 배우는 최소한의 운영체제론
파일시스템과 가상메모리
강사님이 유저레벨에서 커널레벨로 가려면 파일을 통해서 가는거라 했잖아요 리눅스에서/dev /sys 등 이런 디렉터리에서 파일들을 정리해놓은게 파일시스템이잖아요근데 이 파일시스템의파일들이 강사님이 말한 그 파일인가요?? 만약 제가 맞게 이야기한거라면 파일시스템은 유저수준인가요?? (파일이라는게 커널과 유저를 연결하는 것도있으니까)그리고 커널수준의 프로그램에게 전달하죠? 프로세스 마다 가상메모리를 사용한다고 하셨는데요 리눅스의 프로세스는 혹시 리눅스의 swap에 있는 거에서 쓰는거 맞죠?
-
미해결유니티(Unity)로 시작하는 게임개발: Part 3. 슈팅게임 개발
Destroy 함수 질문
Object 클래스 안에 static 함수로 있다면,Random.Range(0,10); 과 같이 클래스이름.함수이름()Object.Destroy(object); 이렇게 호출해야 하는게 아닌가요??헷갈리네요 ㅠ
-
미해결홍정모의 따라하며 배우는 C언어
안녕하세요
안녕하세요인프런은 처음인데따배C강의 무제한이면 언제든지 계속 들을수있는건지 궁금합니다.혹시 아는내용은 스킵해도 수료증발급가능한지도 궁금합니다.감사합니다.
-
해결됨직장인에게 꼭 필요한 파이썬-아래아한글 자동화 레시피
스타일 찾아 다른 스타일로 바꾸는 방법 문의
안녕하세요. 수업을 듣다가(앞 5강의 정도)당장 필요한 자동화 기능이 있어서 문의드립니다. 예를 들어 스타일 표1과 표2가 한 문서 안에 있을 때파이썬으로표1 스타일을 모두 찾아 표2 스타일로 바꾸는 방법이 있을까요? 도움이 될 강의 제목이나구체적 방법을 알려 주시면 감사하겠습니다.
-
해결됨Slack 클론 코딩[백엔드 with NestJS + TypeORM]
socket.io 사용 시 cors 에러 with react
안녕하세요 제로초님~! 최근에 socket.io 문제를 해결해주셔서 감사합니다. 제로초님 덕분에 몇주간 있었던 불면증이 사라졌습니다. 이번에 드리고자 하는 질문은 백엔드 api 서버와 리액트 로컬호스트의 websocket 연결에서 cors 에러가 사라지지 않고 있다는 것입니다.프론트와 백엔드 둘다 localhost로 사용했을땐 문제 없이 잘 작동하였으나, 백엔드 api 서버와 프론트(리액트) http://localhost:3000 로 연결하려 하니 cors 에러가 사라지질 않네요.백엔드 api 서버주소는 https://api.yubinhome.com/ 이고, traefik 을 사용해 https 인증을 받고 있습니다.제가 어떤 부분을 놓친 것인지 함께 봐주실 수 있을까요? 에러메시지 Access to XMLHttpRequest at 'http://api.yubinhome.com/socket.io/?EIO=4&transport=polling&t=Ohzm2CT' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request. GET http://api.yubinhome.com/socket.io/?EIO=4&transport=polling&t=OhzmhTk net::ERR_FAILED 요청헤더 응답헤더 시도 해 본 방법1. 공식 문서에 나온대로 api url 에 직접 연결해보니 서버가 작동하고 있는 것은 확실해보입니다.소켓io 공식문서 cors : https://socket.io/docs/v3/handling-cors/#troubleshooting2. 서버측 origin, credetials 를 설정하였습니다. origin : "*" 가 문제인가 싶어 http://localhost:3000 url 을 직접 주었습니다. 클라이언트 측에는 withCredentials: true 을 설정해주었습니다.백엔드 api 서버 코드https://github.com/fog-of-war/dev-be/blob/dev/src/events/events.gateway.ts@WebSocketGateway({ cors: { origin: "http://localhost:3000", methods: ["GET", "POST"], allowedHeaders: ["authorization", "Authorization"], credentials: true, }, namespace: /\/ws-.+/, transports: ["websocket", "polling"], })리액트 코드https://github.com/fog-of-war/dev-fe/blob/46a8de3a13de4039e9aa511a07cfeea23d8a85fa/src/components/Notifications/NoticeNotifications.tsxREACT_APP_API_URL=https://api.yubinhome.com/REACT_APP_SOCKET_URL=ws://api.yubinhome.com/v1/ws-alertlet socket: any = null; socket = io(socketUrl + "-" + userId, { withCredentials: true, extraHeaders: { Authorization: `Bearer ${sanitizedToken}`, }, });
-
미해결[백문이불여일타] 데이터 분석을 위한 고급 SQL
리트코드 highest department salary 문제
첨부한 파일에 작성한 것과 같이 오답에서where절과 서브쿼리절에 departmentid가 왜 와야되는지 이해가 가지 않습니다.department.name 이라고 생각을 했는데앞에서 inner join을 했기 때문에 where와 서브쿼리절에 departmentid가 오는건가요?
-
미해결자바 개발자를 위한 코틀린 입문(Java to Kotlin Starter Guide)
Enum Class와 Sealed Class에 대한 질문입니다.
안녕하세요.JAVA만 꽤 오래 사용하다가, 이번에 이직하면서 코틀린을 하게 되어 강사님 강의를 들으며 공부하고 있습니다.많이 부족하지만 너무 자세히 설명해주시고 친절하게 설명해주셔서 덕분에 잘 따라가고 있습니다. 궁금한 내용은 아래와 같습니다.Enum과 static (Companion) 의 차이가 무엇일까, 언제 다르게 사용할까 라는 궁금증이 생겼습니다. 자바를 사용하다가 코틀린 강의를들으면서 가장 인상깊었던 부분인 when 부분입니다. enum과 sealed를 어떻게 실무에서 dto와 사용하는지 예시를 알고 싶습니다.Sealed를 어떤 경우에 사용해야할지 감이 안잡히네요. 혹시 조금 만 더 자세하게 설명을 해주실 수 있을까요? 바쁘실텐데 감사합니다. ps. 강사님 발음에 매번 취하고 있습니다.. :)
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
h2.bat 입력시 실행이 되지 않습니다
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예[질문 내용]cmd에서 h2.bat 입력시 해당 화면만 뜨고 실행되지 않습니다.자바 11을 쓰고 있으며 환경변수도 확인했고h2 재설치, 자바 재설치도 해봤습니다파일탐색기에서 h2.bat 파일을 실행해도 결과는 똑같습니다뭐가 문제일까요
-
미해결
테스트111
ㅎㅇㄹㅇㄹ
-
해결됨팀 개발을 위한 Git, GitHub 입문
강의자료 부탁드립니다!
강의자료 부탁드립니다! sigforever01@naver.com
-
미해결[개정판] 파이썬 머신러닝 완벽 가이드
파이썬 머신러닝 완벽 가이드 개정전 서적
파이썬 머신러닝 완벽가이드 2020버전을 가지고 있습니다2022개정판을 새로 구입해서 강의를 듣는 것이 더 효율적일까요?많이 다르지 않다면 2020년 버전으로 강의를 들어도 문제가 없을지 궁금합니다!!
-
해결됨스프링 핵심 원리 - 기본편
ObjectProvider와 new 객체 생성의 차이
해당 강의에서 ObjectProvider를 사용하여 DL 방식으로 컨테이너에서 PrototypeBean 객체를 찾고 PrototypeBean은 prototype 스코프이므로 새로운 객체를 생성하고 반환해준다고 이해했습니다.새로운 객체를 생성하여 반환하는 것이라면 굳이 ObjectProvider를 사용하지 않고 new 객체를 생성하여 사용해도 되지 않을까요? 이 부분이 궁금해서 질문드립니다.제 생각에는 ObjectProvider를 사용하면 만약 prototype 스코프의 객체가 다른 객체를 자동으로 주입받아야 할 때 new 객체는 사용자가 의존관계를 주입해주어야 하므로 문제가 생깁니다. 따라서 스프링의 DI 기능을 사용하기 위해 사용하는 것 같다고 생각됩니다.<ObjectProvider 사용> @Scope("singleton") static class ClientBean { @Autowired private ObjectProvider<PrototypeBean> prototypeBeanProvider; public int logic() { PrototypeBean prototypeBean = prototypeBeanProvider.getObject(); prototypeBean.addCount(); return prototypeBean.getCount(); } }<new 객체 사용> @Scope("singleton") static class ClientBean { public int logic() { PrototypeBean prototypeBean = new PrototypeBean(); prototypeBean.addCount(); return prototypeBean.getCount(); } }
-
미해결Practical Testing: 실용적인 테스트 가이드
ProductNumber 계산 로직
안녕하십니까! 먼저 항상 좋은 강의 감사드립니다.특히 이번 강의에서는 Transaction에서 readOnly 옵션을 사용하므로써 JPA 최적화를 통해 성능 향상을 이점을 얻을 수 있다와 함께,CQRS 측면을 말씀해 주셔서 좋았습니다!저의 경우는 아직 master/slave DB 구조를 다뤄본적이 없어서 몰랐는데, 이렇게 readOnly 옵션을 사용할 경우 DB endpoint를 구분하여 명시하므로써 master/slave DB 구조를 사용할 수 있다는 측면도 알게되어서 좋았습니다.본론으로 넘어가서, Q1. ProductNumber를 계산하는 로직을 DB에서 최신값을 읽어온 후에 ,그 값을 기반으로 다음 productNumber 값을 계산하는 로직을 저의 경우는 동시성 이슈를 고려하여 , 1.일단 SaveAndFlush()로 Id를 할당받고 2. 그 Id 값으로 만들자 라는 로직을 사용하였습니다.(IDENTITY 전략이므로 테이블당 1부터 Id가 할당되기 때문에 가능)이러한 저의 로직에 문제가 있는지 피드백 주시면 정말 감사하겠습니다.특히 calculateProductNumber() 메소드를 저의 경우는 도메인 주도 전략에 기반하여 서비스의 private Method로 정의하지 않고 , Entity 안에 정의하여 사용하는 편인데, 이러한 스타일에 대해서도 문제가 없을지 여쭤보고 싶습니다.Q2.두번째로 저의 경우는 createProduct() 메소드 테스트를 1.처음 생성일의자리 productNumber로 생성십의자리 productNumber로 생성백의자리 productNumber로 생성1000개를 넘어가면 예외발생으로 구분하여 테스트 하였습니다.그런데 이 테스트를 한꺼번에 돌렸을 땐 직전 테스트로 이미 저장된 Product에 의해 다음 테스트에 영향을 미쳐 일부 테스트가 실패하는 상황이 발생하였습니다.이상황을 어떻게 해결할 수 있을지 질문 드리고 싶고(sleep() 으로 간격을 주어야 할까요,,)또한 이 원인이 테스트를 한꺼번에 실행시킬 경우,각 테스트 메소드가 각 쓰레드로 동시에 실행되기 때문인지여쭤보고 싶습니다! 감사합니다.