[질문 템플릿] 1. 강의 내용과 관련된 질문인가요? ( 예 /아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? ( 예 /아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? ( 예 /아니오) [질문 내용] 여기에 질문 내용을 남겨주세요. 강의 내용에 entity에 setter는 사용하지 않는다 변경내용을 추적하기 어렵다. 변경 확인하려면 오랜 시간이 소요될 수 있다라고 말씀해주셨는데, entity에 직접적으로 setter 를 쓰지 않고 dto에서 entity 로 옮겨서 save 할 때, toEntity toDto 메소드를 만들어서 일일히 사용하고 있다가 스프링에서 지원하는 BeanUtils.copyPropertyies(source,target) source -> target으로 복사하는 메소드를 알게 되었고, 이게 작동되려면 source에는 getter 가 target 에는 setter 가 필요한 걸로 알고 있는데 화면에서 받아온 requestDTO 를 entity로 복사할 때 entity에 setter 가 필요한데 이걸 사용하기보다 그냥 builder 패턴을 사용한 메소드를 사용하는 게 맞을까요?.. 궁금하여 질문드립니다..
========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] 여기에 질문 내용을 남겨주세요. V3.1 실행 후 콘솔창에 뜨는 쿼리문이 다음과 같이 뜹니다. springboot version 3.2.1 이고 Hibernate5JakartaModule로 설정했습니다. application.properties 도 아래와 같이 설정했습니다. 그외 부분도 강사님 코드를 그대로 복붙해도 다음과 같이 물음표가 너무 많이 뜨는데 버전 문제인건가요?
지금 서비스엔티티에서 작업자와 상품이 2개 전부 1:N 상태입니다 @Query("select s from Services s join fetch s.workers w " + "join fetch s.serviceTime st " + "where s.id = :id") Services findByIdWithWorkers(@Param("id") Long id); OneToMany인 경우 2개가 동시에 fetch join이 안되는걸 알고 application.yml에 jpa: hibernate: ddl-auto: update properties: hibernate: default_batch_fetch_size: 100 format_sql: true show-sql: true 위에 spring: 있습니다 이렇게 default_batch_fetch_sizes을 추가했는데 sql에 Hibernate: select rg1_0.service_id, rg1_0.id, rg1_0.base_category, rg1_0.created_at, rg1_0.price, rg1_0.service_item_name, rg1_0.service_time, rg1_0.sub_category, rg1_0.super_category, rg1_0.updated_at from reservation_goods rg1_0 where rg1_0.service_id=? in이 나오지 않는데 데이터가 지금 10개 정도 있는데 데이터 작아서 in절이 나오지 않는걸까요?
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] 안녕하세요 강의를 듣다가 아래가 동작하지 않아서 import javax.persistence.Entity; 아래 줄로 일단 넘어갔는데요 import jakarta.persistence.Entity; 스프링부트가 이제는 JDK-17로 어쩔수 없이 환경설정을 해야해서 17로 했느데요 모든 강의가 중 이렇게 조금씩 동작을 안하는 수정된 부분을 영상으로 업로드할 계획이 있으신가요? 아니면 누군가 미리 듣고서 한번 당해보고 그분이 또는 본인이 질문하고 질문의 답변을 알아서 찾아서 적용해서 들어야할까요?ㅠ
[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발
@ExceptionHandler(UserNotFoundException.class) public final ResponseEntity<Object> handleUserNotFoundException(Exception ex, WebRequest request) { ExceptionResponse exceptionResponse = new ExceptionResponse(new Date(), ex.getMessage(), request.getDescription(false)); return new ResponseEntity<>(exceptionResponse, HttpStatus.NOT_FOUND); } 강의에서 WebRequest를 이용하여 exception handling을 하고 있는데, 아래처럼 BindingResult를 사용하는 방법과 어떤 부분이 다른가요? 개발 스타일에 따라 사용하면 될까요? @ExceptionHandler(MethodArgumentNotValidException.class) public ResponseEntity<ErrorResponse> handleMethodArgumentNotValidException(MethodArgumentNotValidException e) { List<String> errorMessages = e.getBindingResult().getFieldErrors() .stream() .map(FieldError::getDefaultMessage) .collect(Collectors.toList()); String combinedErrorMessage = String.join(", ", errorMessages); return ResponseEntity.badRequest().body(new ErrorResponse(combinedErrorMessage)); }
[질문 내용] 영상 12:45 내용입니다. 제목 그대로 MemeberRepositoryTest를 실행하는 과정에서 Transaction없이 실행하면 Error가 발생해야 하는데, 발생하지 않습니다. 왜 그런지 궁금합니다. 질문을 수정하겠습니다. 실행결과를 다시 살펴보니 Error가 발생하지 않는 것이 아니라 Test가 실행되지 않고 있었네요ㅜ TDD 자체가 실행되지 않았습니다. @Transactional을 설정하고 다시 실행하였더니, test file 자체가 생성되지 않았고, fail인지 아닌지도 확인할 수 없었습니다.
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? 예 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예 3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예 [질문 내용] 여기에 질문 내용을 남겨주세요. 프로젝트 버전 17, gradle 버전도 17로 동일하게 맞췄는데 실행이 되지 않아요 ㅠㅠ 뭐가 문제인거죠? ㅠ
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jdk-11.0.13\bin\java.exe 에러 위와 같은 에러가 발생합니다. 하지만 사진에서 보듯 JAVA_HOME은 jdk17로 설정이 되어있고, 환경 변수 설정이 제대로 동작하고 있음을 확인할 수 있습니다. 그러나 gradlew build를 진행하면 변경전 jdk11을 계속 실행하려고 해서 오류가 발생합니다. settings -> gradle 도 17로 잘 설정되어있습니다. Project Structure -> Project에 들어가도 잘 설정되어있습니다. 삽질 중인데... 도와주시면 감사하겠습니다 === 질문을 하고 한번더 실행해봤는데 성공하였습니다. Q) 왜 성공했는지 알 수 있을까요? cache 떄문에 그런것이었는지.. 아니면 환경변수 변경이 적용되기까지 시간이 걸리는 것인지요? 이 질문은 다른 분들을 위해 남겨두겠습니다!
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] 세팅을 하는 도중, Junittest를 하려고하는데 Nosuchmethod 오류가 발생해 구글링 후 window - preferences - gradle - advanced option- program argyments 에 -Pjunit-jupiter.version=5.10.0 이 코드를 추가했는데 상관이 없는지 여쭤보려고 글 작성하였습니다. 해당 답변은 https://stackoverflow.com/questions/77110882/i-cant-run-junit-5-9-x-tests-in-eclipse-2023-09-4-29-0/77150487#77150487 여기서 얻었습니다. [추가질문] 기존 sts4로 공부를하는데 강사님이 사용하시는 intelliJ를 사용하는게 좋은지도 궁금합니다!
java: cannot find symbol symbol: method isEqualTo(hello.hellospring. domain. Member) location: variable result of type hello.hellospring.domain.Member 계속 에러나고 구글링해도 안나와요 ㅠ도와주세여
JDBC 템플릿을 사용해 글을 작성하거나 리스트를 조회하면 이런오류가 발생합니다. ㅠㅠ 그런데 실제로 글이 잘 저장/조회 하는데는 문제가 없습니다. 다만 작업시마다 저오류가 발생합니다; 구글에서 나오는 서비스 - Listener 재시작, ora파일 수정 등의 조치는 다 해본상황입니다.. 어떻게하면좋을까요 ㅠ
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] 오류가 나올때마다 구글링을 하여 해결하고 있는데, 점점 버전을 제가 스스로 내려야 사용이 가능이 되네요, 이게 맞는걸까요
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] 인프런 질문 게시판에는 스프링부트 3.0 이상을써라 3.0 이상이면 jdk 17 이상 써야된다 하셔서 3.0 이상으로 다운도 받았고 버전도 21로 사용하고 있는데, A problem occurred configuring root project 'hello-spring'. > Could not resolve all files for configuration ':classpath'. > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.2.1. Required by: project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.1 > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.2.1 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.5' but: - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 declares a library, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.1 declares a library, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.1 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. 이런 오류가 나와서 build.gradle 에서 플러그인을 id 'org.springframework.boot' version '2.6.3' 로 바꿨고 dependencies 에 implementation 'org.springframework.boot:spring-boot-starter' 를 추가하였더니 오류는 안나더군요 이렇게 해결하는게 맞는건가요? 그럼 스프링부트 버전이 3.0 이상이 아닌 2.6.3버전을 사용하게 되는건데 괜찮은건가요?
해당 부분 메세지 관련하여 알아본 내용으로는, Hello 클래스를 선언할 때 접근제한자가 생략되어 private으로 취급되는데 helloApi 메소드는 public이어서 private 클래스가 외부로 노출되어 뜨는 경고라고 합니다. 이 내용이 맞는 것인지, 맞다면 해당 방식의 작성법은 문제점이 있을 수 있는 방식인지 답변 부탁드립니다.