강의하는 영상보며 항상 배우고 있습니다. 요즘 알고리즘 문제도 공부하면서 항상 고민인 부분인데요. if-else문에서 else를 써야하는가 입니다. 강의7:16초에서 영한님은 else를 사용하지 않으시더라구요. 그래서 궁금해서 웹에 검색을 하니 camelcase급으로 표준화된 방식이다. 아니다 케이스 바이 케이스다. eslint라는 곳에서는 if 다음에 return이 있으면 else쓰지마라 라고도 하더라구요. 질문 : 현업에서는 else를 지양하는 편인가요?
@GetMapping("/members/new") public String createForm(Model model){ model.addAttribute("memberForm", new MemberForm()); return "members/createMemberForm"; } model.addAttribute를 사용하지 않고 일단 createMemberForm.html로 간 뒤에 form post로 데이터를 넘기면 @PostMapping("/members/new") 컨트롤러가 비즈니스로직을 수행하면 되는 것 아닌가요? createMemberForm이라는 html 에 new MemberForm()으로 객체를 넘길 수 있는 내부적인 원리 가 궁금합니다.
강의를 들으면서 h2 인메모리 기능을 보고 매우 좋은 기능이라고 생각이 들었습니다. 한편 "인메모리 h2 데이터베이스도 @Test를 이용해 삽입한 데이터를 눈으로 확인할 수 있을까?"에 대한 궁금증이 남더라구요. 궁금해서 테스트해보았는데 데이터가 남지 않더라구요. 1. main의 application.yml에서 h2를 인 메모리로 바꾸고 서버를 실행하였습니다. (서버를 메모리상에서 계속 실행시켜두고 싶었습니다.) 2. http://localhost:8080/h2-console에 들어가보니 테이블이 정상적으로 생성된걸 확인할 수 있었습니다. 3.test의 application.yml애서 h2를 인메모리로 바꾸었습니다. ->test의 application.yml의 ddl-auto를 none으로 하니 main에서 스프링을 실행시켜 서버를 구동하고 테이블을 만들었음에도 불구하고 Test는 서버를 찾지 못한다. 즉 main의 인메모리 서버와 Test의 인메모리 서버는 application.yml에서 이름을 동일하게 했음에도 작동을 안하는것을 보면 Test의 h2(인메모리)와 main의 h2(인메모리)는 독자적으로 작동한다. 4.Test의 회원가입을 ROLLBACK을 false로 바꾸고 실행해 보았습니다. (이때 서버가 인메모리가 아닌 경우,즉 일반 TCP h2 서버에는 데이터가 테스트이후에도 남아있었습니다.)(Test의 ddl-auto는 create) ->main(실제어플리케이션)와 @Test의 h2인메모리는 서로 다르기 때문에 ddl-auto값이 none이였으면 실패했을것이고 create이기때문에 테이블을 만들 수 있어 테스트가 실패하지않고 진행되었다. 5.확인해보니 h2 인메모리 서버에는 데이터가 남아있지 않았습니다. ->h2인메모리는 @Test와 main(실제어플리케이션)에서 각자 독자적으로 실행되기때문에 남지않는다. ->h2를 인메모리로 할 경우 Test가 끝나면 삽입했던 데이터를 메모리에서 삭제해버리기때문에 ROLLBACK을 false로 해도 인메모리 h2 서버에는 데이터가 남지 않는다. 즉 tcp h2서버를 사용할때 @Test에서 rollback을 false로 해두면 데이터베이스에 데이터가 삽입된걸 눈으로 확인 할 수 있지만 @Test에서는 애초에 main과 다른 h2인메모리를 사용하고 테스트가끝나면 @Test의 인메모리h2를 삭제해버리기 때문에 눈으로 확인할 수 없다라고 이해를 했는데 옳바른 이해일까요? 한편으로 데이터가 데이터베이스에 삽입 삭제하는걸 눈으로 확인 하고 싶을 것 같은데 h2데이터 베이스를 인메모리로 두면 확인이 안될것 같아서 불안할 것 같더라구요. 만약 현업에서 테스트를 한다면 인메모리보다는 아예 개발DB를 두고 테스트를 하기때문에 이러한 고민은 안해도 되는게 맞는거겠죠?
안녕하세요, 강의에는 나오지 않았지만 변경감지를 병합보다 추천하셔서 DTO를 사용해서 한 번 짜보았는데 봐주실 수 있나요? ```java package jpabook.jpashop.service; import lombok.Getter; import lombok.Setter; @Getter @Setter public class UpdateItemDto { private Long id; private String name; private int price; private int stockQuantity; private String author; private String isbn; } ``` 일단 UpdateItemDto는 간단히 Getter, Setter만으로 구성했습니다. @PostMapping("items/{itemId}/edit") public String updateItem(@PathVariable("itemId") Long itemId, @ModelAttribute("form") BookForm form) { UpdateItemDto updateItemDto = new UpdateItemDto(); updateItemDto.setId(form.getId()); updateItemDto.setName(form.getName()); updateItemDto.setPrice(form.getPrice()); updateItemDto.setStockQuantity(form.getStockQuantity()); updateItemDto.setAuthor(form.getAuthor()); updateItemDto.setIsbn(form.getIsbn()); itemService.updateItem(itemId, updateItemDto); return "redirect:/items"; } 위 코드는 ItemController 안의 updateItem 메소드입니다. @Transactional public void updateItem(Long itemId, UpdateItemDto updateItemDto) { Item findItem = itemRepository.findOne(itemId); //findItem으로 찾아온 값은 영속상태 findItem.change(updateItemDto); } 위 코드는 ItemService 클래스의 updateItem 메소드입니다. public void change(UpdateItemDto updateItemDto) { // if (updateItemDto.getId() != null) { // this.id = updateItemDto.getId(); // } if (updateItemDto.getName().length() != 0) { this.name = updateItemDto.getName(); } // if (updateItemDto.getPrice() != null) { // this.price = updateItemDto.getPrice(); // } // if (updateItemDto.getStockQuantity() != null) { // this.stockQuantity = updateItemDto.getStockQuantity(); // } this.price = updateItemDto.getPrice(); this.stockQuantity = updateItemDto.getStockQuantity(); // if (updateItemDto.getAuthor() != null) { // this.author = updateItemDto.getAuthor(); // } // if (updateItemDto.getIsbn() != null) { // this.isbn = updateItemDto.getIsbn(); // } } 마지막으로 Item 클래스의 change 메소드입니다. Book의 상위 클래스이기 때문에 author과 isbn 필드가 없어서 이 change 메소드를 Book 클래스 내로 옮겨야 하는지 고민을 했습니다. 그러나 그렇게 진행하면 부수적인 문제가 너무 많이 생겨 그냥 Item 클래스 내에 남기고 author와 isbn을 수정하는 기능은 없앴습니다. id는 바꿀 필요가 없다고 생각하여 기능을 뺐습니다. Form에도 id를 수정하는 란은 없는데 기존에 영한 님이 강의하실 때 ItemController 내에서 book.setId(form.getId)); 하셨는데 잘못된 부분인 것 같습니다. name같은 경우 String이라 웹 상에서 수정을 할 때 빈 칸으로 두면 null보다 empty string으로 받는 것 같아서 updateItemDto.getName() != null 조건에 안 걸리는 것 같더라구요. 그래서 빈 칸을 empty string을 찾는 식으로 짰습니다. 마지막으로 price와 stockQuantity는 int라서 != null 조건을 걸수가없는데 웹 상에서 빈 칸일 때 이전 price와 stockQuantity를 유지하는 방법을 여쭤보고 싶습니다. 결론적으로 제 질문은: 1. UpdateItemDto의 경우 controller 패키지의 BookForm과 이름 외에 똑같은데 그래도 DTO 클래스를 따로 만드는데 의의가 있는건가요? 2. ItemController 내에서 어설프게 Entity를 생성하지 말라고 하셨는데 DTO 객체를 생성하는 것은 괜찮은가요? 3. 전반적으로 이런 방식으로 변경감지를 하는건지가 궁금합니다. 4. change 메소드를 Item 밑에 두는게 맞는지 Book 밑에 두는게 맞는지? 답변 주시면 정말 큰 도움이 될 것 같습니다. 감사합니다!
에러 코드 전문 java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:248) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) 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: mapping values are not allowed here in 'reader', line 10, column 15: properties: ^ at org.yaml.snakeyaml.scanner.ScannerImpl.fetchValue(ScannerImpl.java:910) at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:400) at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:251) at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:628) at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:166) at org.yaml.snakeyaml.comments.CommentEventsCollector$1.peek(CommentEventsCollector.java:59) at org.yaml.snakeyaml.comments.CommentEventsCollector$1.peek(CommentEventsCollector.java:45) at org.yaml.snakeyaml.comments.CommentEventsCollector.collectEvents(CommentEventsCollector.java:140) at org.yaml.snakeyaml.comments.CommentEventsCollector.collectEvents(CommentEventsCollector.java:119) at org.yaml.snakeyaml.composer.Composer.composeScalarNode(Composer.java:214) at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:184) at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:314) at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:305) at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:286) at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:188) at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:314) at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:305) at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:286) at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:188) at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:115) at org.yaml.snakeyaml.constructor.BaseConstructor.getData(BaseConstructor.java:135) at org.springframework.boot.env.OriginTrackedYamlLoader$OriginTrackingConstructor.getData(OriginTrackedYamlLoader.java:99) at org.yaml.snakeyaml.Yaml$1.next(Yaml.java:514) at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:198) at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:166) at org.springframework.boot.env.OriginTrackedYamlLoader.load(OriginTrackedYamlLoader.java:84) at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:50) at org.springframework.boot.context.config.StandardConfigDataLoader.load(StandardConfigDataLoader.java:54) at org.springframework.boot.context.config.StandardConfigDataLoader.load(StandardConfigDataLoader.java:36) at org.springframework.boot.context.config.ConfigDataLoaders.load(ConfigDataLoaders.java:107) at org.springframework.boot.context.config.ConfigDataImporter.load(ConfigDataImporter.java:128) at org.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:86) at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:116) at org.springframework.boot.context.config.ConfigDataEnvironment.processInitial(ConfigDataEnvironment.java:240) at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:227) at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:102) at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:94) at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:102) at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:87) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131) at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:85) at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:66) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120) at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:114) at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:65) at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:344) at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:132) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) ... 27 more 환경설정 1.yml spring: datasource: url: jdbc:h2:tcp://localhost/~/jpashop username: sa password: driver-class-name: org.h2.Driver jpa: hibernate: ddl-auto: create properties: hibernate: # show_sql: true format_sql: true logging.level: org.hibernate.SQL: debug 2.gradle plugins { id 'org.springframework.boot' version '2.7.3' id 'io.spring.dependency-management' version '1.0.13.RELEASE' id 'java' } group = 'jpabook' version = '0.0.1-SNAPSHOT' sourceCompatibility = '11' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'junit:junit:4.13.2' compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.h2database:h2' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' } tasks.named('test') { useJUnitPlatform() } 해결을 위해 시도했던 것들 1. yml에 ;MVCC=TRUE를 삭제해보았다. (X) 2. h2 DB가 실행되지 않아서 발생할 수 있다는 답변을 보고 켜보았다. (X) 3. yml을 복붙해서 다시 실행해보았다. (X) 4. Test에 @WebAppConfiguration 어노테이션을 추가해보았다. (X)
안녕하세요. 영한님 강의 중에 http 도 들었어서 궁금함이 생겨 질문합니다. 데이터 수정을 하시는 부분에서 @PostMapping을 쓰셨는데 이건 그냥 회사 규율이나 개발자 취향에 따라 쓰는 건가요? 리소스의 일부분을 수정하는 것으로 Patch가 있는 걸로 알고 있고 이때 @PatchMapping 을 사용해도 되는 것인지 잘 모르겠어서요. 감사합니다.
1. 엔티티에서 setter는 지양하라고 말씀하셨는데 예를 들면 Order의 연관관계 메서드를 작성 시 OrderItem의 setter가 사용됩니다. 이 때 setter를 사용하지 않고 양방향 연관관계 세팅을 할 수 있는 방법이 무엇이 있을까요? 2. 양방향값 세팅은 양방향연관관계일 때 필수적인 건가요?
양방향 연관관계에서는 양쪽에 값을 설정해주어야 합니다. 1. OrderItem의 경우 Item을 생성 메서드의 orderItem.setItem(item)을 통해 값을 설정해 준 것인가요? 2. 일대다 에서 일에서 다로 가는 단방향 연관관계에서는 '다' 쪽이 외래키를 가지므로 '다' 쪽에서 '일'쪽의 값을 설정해 주어야하나요?
안녕하세요. 강의를 듣다가 막히는 부분이 생겨 질문 드립니다. VSC상에서 npm install react-router-dom --save를 칠 때부터 이런 종류의 문구가 뜨더니, npm run start를 하면 새로운 포트로 연결이 성공되었다는 문구는 뜨지만, 아무 글씨도 나타나지 않은 흰 배경만 있습니다. 혹시 어떤 점이 문제인지 알 수 있을까요?? 구글링도 해보고 npm audit?? 그것도 시도해봤는데 해결되지 않습니다ㅠㅠㅠ *현재 window쓰고 있고, VSC로 작업하고 있습니다 *App.js 코드 첨부하겠습니다. import React from "react"; import { Routes, Route} from "react-router-dom"; import ChatPage from "./components/ChatPage/ChatPage"; import LoginPage from "./components/LoginPage/LoginPage"; import RegisterPage from "./components/RegisterPage/RegisterPage"; function App(props) { return ( <Routes> <Route path="/" element={<ChatPage />} /> <Route path="/login" element={<LoginPage />} /> <Route path="/register" element={<RegisterPage />} /> </Routes> ); } export default App;
1. 예를들어 자유게시판, 건의게시판 이렇게 여러개가 있고 기능은 거의 똑같지만 건의에는 사진업로드 기능이 추가로 존재할 때 자유게시판 컨트롤러, 레파지토리, 모델, ... 건의게시판 컨트롤러, 레파지토리, 모델, ... 이렇게 다 각자 만들어줘야 하나요? 아니면 컨트롤러 레파지토리 모델 자유,건의 게시판 통합해서 만드나요? 2. DB에서 테이블도 자유, 건의 게시판 따로 만들어서 개발하나요? ( title, content 이런 것들 )
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] 여기에 질문 내용을 남겨주세요. JPA에서 enum을 활용할 때 질문드리겠습니다. 요일을 enum 타입으로 만들어 (0~6, 일~월 이런 형식) 체크 박스로 입력을 받아, 체크를 선택한 요일은 매장의 휴무일로 지정하는 로직을 구현하는 중입니다. @ElementCollection을 활용하여 간단하게 처리하려고 했으나, 추천하시는 방식이 따로 있길래 어떤 식으로 로직을 작성해야 하는지가 너무 궁금해졌습니다. https://www.inflearn.com/questions/21303 1. 위에서 영한님께서 해주신 답변 중, 2번의 경우를 추천하셨기에 2번으로 진행하려고 하였습니다! 혹시 이 경우, 2번 방법을 추천하신 이유가 무엇인지가 궁금합니다!!! 2. 위 링크의 2번 로직으로 코드를 작성하면 다대다 엔티티 매핑이 발생하는데 개인적인 생각에 요일과의 매핑은 단순히 요일과 요일에 엮여있는 매장 ID값만 알면 되는 것 같아 @ManyToMany를 그대로 사용해도 되는 건가?? 라는 생각이 들었습니다. 그대로 사용을 해도 좋은지 아니면 1 : N, N : 1로 풀어주는 것이 좋은지 궁금합니다!!!! 또, 이렇게 요일을 처리하는 구현을 Enum보다 추천하실만한 방법이 있는지, 있다면 어떤 방식인지도 말씀해주시면 감사드리겠습니다!! 날씨가 많이 더운데 더위 조심하시고 폭우 조심하세요! 감사합니다
공공데이터와 Folium(Python Library)으로 만드는 제주 오름 지도 안내 서비스
제주 오름 강의를 모두 수강한 뒤 다른 공공API를 이용해서 응용 연습을 해보고 있습니다. 체크박스로 원하는 주소 마커만 보는 기능을 사용했고 마커에 커스텀 아이콘을 사용했습니다.(아이콘 2가지 사용) 이제 부트스트랩에 적용해보려하는데 iconUrl길이가 너무 길어서 코드가 복잡해보입니다. iconUrl을 다른 코드로 대체해서 아이콘이 보이도록 할 수 있을 까요?
[질문 내용] 강의 내용 중 "JPA와 DB 설정 동작 확인"의 20분 경부터 나오는 ./gradlew clean build 를 실행하다가 -> 아래 화면 캡처와 같이 java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132 에러가 발생했습니다. Test 파일 2개 모두 동일한 에러 메시지입니다. 커뮤니티의 답변 및 구글 검색을 통해 문제를 해결하려 했으나, 해결하지 못해 문의드립니다. (커뮤니티 답변에서 저와 동일한 에러를 만난 경우는 진도가 더 나간 상태에서 발생한 에러였으며, 구글링에서는 대부분 AWS배포와 관련되어 이 에러가 발생하고 그것을 해결한 케이스였습니다.) Test 파일 2개는 아래와 같이 작성되었습니다. 커뮤니티 답변을 모두 확인한 것은 아니었기에, 혹시 저와 동일한 상황에서 동일한 에러가 해결된 경우가 있다면 링크를 부탁드립니다. (혹, 답변을 위해 더 공유해야 할 내용이 있다면 알려주세요)
23분쯤에 UpdateItemDTO를 service계층에서 만들고 controller로부터 String name, int price... 이렇게 따로 받지말고 dto로 한번에 받는게 좋은 설계다 라고 말씀 해주셨는데 그러면 Controller에서 service 계층의 UpdateItemDTO를 알고 있어야 DTO를 service계층으로 보내줄텐데 이렇게 되면 UpdateItemDTO를 service계층에 만드는것은 문제가 따로 없는건가요? 서로 다른 계층에 대해서는 서로 몰라야 한다고 생각했는데 헷갈려서 질문 드립니다.
ilerplate-mern-stack-master\boilerplate-mern-stack-master> npm install npm WARN old lockfile npm WARN old lockfile The package-lock.json file was created with an old version of npm, npm WARN old lockfile so supplemental metadata must be fetched from the registry. npm WARN old lockfile npm WARN old lockfile This is a one-time fix-up, please be patient... npm WARN old lockfile npm WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.) npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) npm WARN deprecated bcrypt@3.0.8: versions < v5.0.0 do not handle NUL in passwords properly npm WARN deprecated node-pre-gyp@0.14.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future npm ERR! code 1 npm ERR! path C:\Users\SAMSUNG\OneDrive\바탕 화면\PersonalProjects\WebProjects\boilerplate-mern-stack-master\boilerplate-mern-stack-master\node_modules\bcrypt npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c C:\Users\SAMSUNG\AppData\Local\Temp\install-ca11b823.cmd npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\SAMSUNG\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\SAMSUNG\OneDrive\바탕 화면\PersonalProjects\WebProjects\boilerplate-mern-stack-master\boilerplate-mern-stack-master\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\SAMSUNG\OneDrive\바탕 화면\PersonalProjects\WebProjects\boilerplate-mern-stack-master\boilerplate-mern-stack-master\node_modules\bcrypt\lib\binding --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1) npm ERR! node-pre-gyp info it worked if it ends with ok npm ERR! node-pre-gyp info using node-pre-gyp@0.14.0 npm ERR! node-pre-gyp info using node@17.4.0 | win32 | x64 npm ERR! node-pre-gyp WARN Using needle for node-pre-gyp https download npm ERR! node-pre-gyp info check checked for "C:\Users\SAMSUNG\OneDrive\바탕 화면\PersonalProjects\WebProjects\boilerplate-mern-stack-master\boilerplate-mern-stack-master\node_modules\bcrypt\lib\binding\bcrypt_lib.node" (not found) npm ERR! node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.8/bcrypt_lib-v3.0.8-node-v102-win32-x64-unknown.tar.gz npm ERR! node-pre-gyp http 404 https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.8/bcrypt_lib-v3.0.8-node-v102-win32-x64-unknown.tar.gz npm ERR! node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.8/bcrypt_lib-v3.0.8-node-v102-win32-x64-unknown.tar.gz npm ERR! node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.8 and node@17.4.0 (node-v102 ABI, unknown) (falling back to source compile with node-gyp) npm ERR! node-pre-gyp http 404 status code downloading tarball https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.8/bcrypt_lib-v3.0.8-node-v102-win32-x64-unknown.tar.gz npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@9.0.0 npm ERR! gyp info using node@17.4.0 | win32 | x64 npm ERR! gyp info ok npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@9.0.0 npm ERR! gyp info using node@17.4.0 | win32 | x64 npm ERR! gyp info find Python using Python version 3.10.2 found at "C:\Users\SAMSUNG\AppData\Local\Programs\Python\Python310\python.exe" npm ERR! gyp ERR! find VS npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details npm ERR! gyp ERR! find VS looking for Visual Studio 2015 npm ERR! gyp ERR! find VS - not found npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 npm ERR! gyp ERR! find VS npm ERR! gyp ERR! find VS ************************************************************** npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload. npm ERR! gyp ERR! find VS For more information consult the documentation at: npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows npm ERR! gyp ERR! find VS ************************************************************** npm ERR! gyp ERR! find VS npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\SAMSUNG\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47) npm ERR! gyp ERR! stack at C:\Users\SAMSUNG\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16 npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\SAMSUNG\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:363:14) npm ERR! gyp ERR! stack at C:\Users\SAMSUNG\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14 npm ERR! gyp ERR! stack at C:\Users\SAMSUNG\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:384:16 npm ERR! gyp ERR! stack at C:\Users\SAMSUNG\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7 npm ERR! gyp ERR! stack at C:\Users\SAMSUNG\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16 npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:406:5) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28) npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1090:16) npm ERR! gyp ERR! System Windows_NT 10.0.19044 npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\SAMSUNG\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\SAMSUNG\\OneDrive\\바탕 화면\\PersonalProjects\\WebProjects\\boilerplate-mern-stack-master\\boilerplate-mern-stack-master\\node_modules\\bcrypt\\lib\\binding\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\\Users\\SAMSUNG\\OneDrive\\바탕 화면\\PersonalProjects\\WebProjects\\boilerplate-mern-stack-master\\boilerplate-mern-stack-master\\node_modules\\bcrypt\\lib\\binding" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v102" npm ERR! gyp ERR! cwd C:\Users\SAMSUNG\OneDrive\바탕 화면\PersonalProjects\WebProjects\boilerplate-mern-stack-master\boilerplate-mern-stack-master\node_modules\bcrypt npm ERR! gyp ERR! node -v v17.4.0 npm ERR! gyp ERR! node-gyp -v v9.0.0 npm ERR! gyp ERR! not ok npm ERR! node-pre-gyp ERR! build error npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\SAMSUNG\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\SAMSUNG\OneDrive\바탕 화면\PersonalProjects\WebProjects\boilerplate-mern-stack-master\boilerplate-mern-stack-master\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\SAMSUNG\OneDrive\바탕 화면\PersonalProjects\WebProjects\boilerplate-mern-stack-master\boilerplate-mern-stack-master\node_modules\bcrypt\lib\binding --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1) npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\SAMSUNG\OneDrive\바탕 화면\PersonalProjects\WebProjects\boilerplate-mern-stack-master\boilerplate-mern-stack-master\node_modules\node-pre-gyp\lib\util\compile.js:83:29) npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:520:28) npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1090:16) npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19044 npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\SAMSUNG\\OneDrive\\바탕 화면\\PersonalProjects\\WebProjects\\boilerplate-mern-stack-master\\boilerplate-mern-stack-master\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" npm ERR! node-pre-gyp ERR! cwd C:\Users\SAMSUNG\OneDrive\바탕 화면\PersonalProjects\WebProjects\boilerplate-mern-stack-master\boilerplate-mern-stack-master\node_modules\bcrypt npm ERR! node-pre-gyp ERR! node -v v17.4.0 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.14.0 npm ERR! node-pre-gyp ERR! not ok npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\SAMSUNG\AppData\Local\npm-cache\_logs\2022-08-08T08_26_57_475Z-debug-0.log vscode는 최신버전을 사용중이고 node -v v17.4.0 npm -v 8.16.0 를 사용하고 있습니다.