묻고 답해요
161만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결스프링 핵심 원리 - 기본편
new AnnotationConfigApplicationContext()
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)예3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)예[질문 내용]여기에 질문 내용을 남겨주세요. new AnnotationConfigApplicationContext()에 들어가는 class 정보는 모두 빈으로 등록되는 것 맞나요? 그래서 DiscountService에 @Component와 @Autowired를 사용하지 않아도 테스트가 통과하는 건가요?
-
미해결Practical Testing: 실용적인 테스트 가이드
LocalDateTime.now() 를 검증하는 테스트에 관하여
안녕하세요.LocalDateTime.now() 를 이용하여 테스트 하는 걸 지양하자라는 강사님 강의 중에 제가 겪었던 경험에 대해 질문이 있습니다.현재 개인적인 프로젝트에서 테스트 코드를 작성하고 있습니다.회원가입을 할때 가입한 시점을 저장하기 위해 LocalDateTime 을 파라미터로 받고 있는데요, 이 로직을 검증하기 위해 테스트 코드를 작성하였습니다.그러나 아래와 같은 에러가 발생하더라구요org.opentest4j.AssertionFailedError: expected: 2024-01-03T21:25:11.333406800 (java.time.LocalDateTime) but was: 2024-01-03T21:25:11.333407 (java.time.LocalDateTime) when comparing values using 'ChronoLocalDateTime.timeLineOrder()' Expected :2024-01-03T21:25:11.333406800 (java.time.LocalDateTime) Actual :2024-01-03T21:25:11.333407 (java.time.LocalDateTime)대략 에러 메세지를 확인해보니 LocalDateTime.now 로 생성한 값과 저장한 뒤에 조회한 시간의 오차가 발생하여 테스트가 실행하는 것 이었습니다.해서 LocalDateTime.now 가 아닌 임의의 시점을 지정해주어서 문제를 해결할 수 있었는데혹시 비슷한 경험을 하신적이 있으신지?있으시다면 제가 말한 방법대로 테스트 코드를 작성하는게 적절한지? 가 궁금합니다!감사합니다!!
-
해결됨실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
회원가입 테스트 코드 관련해 질문 드립니다..ㅠ
7분 08초 정도에 회원가입 테스트 코드를 실행하는 부분에서요,,! MemberServiceTest 클래스에 @Transactional을 걸어서회원가입() 메소드를 하나의 트랜잭션으로 관리하는 것으로 이해했습니다... memberService.join(member); 으로 persistence context에 member를 영속화 시킨 상태인데,그 다음 코드인 memberRepository.findOne(savedId);에서, 왜 select 문이 나가는거죠?하나의 트랜잭션이고, member가 영속 상태라서 1차 캐시에서 관리되면, context에서 가져와야 하는게 아닌가요?... 트랜잭션을 롤백한다는 것의 의미가 DB의 트랜잭션을 롤백한다는 것 뿐만 아닌 영속성 컨텍스트도 롤백하는 것을 의미하나요?.. 만약 그렇다면, 저는 @Transactional을 메소드 단위로 걸었는데, 왜 회원가입() 메소드 중간에 롤백이 되는 건가요?..ㅠ아예 애초부터 스프링에서의 트랜잭션 롤백은 영속성 컨텍스트에 반영조차 하지 않는 거라고 봐야 하나요?.. 너무 헷갈립니다 ㅠ.ㅠ
-
해결됨실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
JUnit5 @Test(expected = ) 미지원하는데 테스트 코드 작성 방법
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]여기에 질문 내용을 남겨주세요.JUnit5를 사용하여 테스트 코드를 작성 중인데, JUnit4와는 다르게 @Test(expected = ) 사용이 불가하더라고요.다음과 같이 테스트 코드를 작성하면 될까요? @Test public void 중복_회원_예약() throws Exception { //given Member member1 = new Member(); member1.setName("kim"); Member member2 = new Member(); member2.setName("kim"); //when memberService.join(member1); assertThrows(IllegalStateException.class, () -> { memberService.join(member2); }); }
-
해결됨실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화
OrderApiController
웹 개발 구조에서backend - repository - service - controller - frontend이런 식으로 이해를 하고 있었습니다. 강의를 수강 중 MemberApiController는 MemberService를 의존관계 주입을 받아 Api테스트를 진행하는데 OrderApiController는 왜 Service를 주입받지 않고 Repository를 주입받아 사용하는지 궁금합니다.
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
<p>태그 관련 질문
1. 강의 내용과 관련된 질문인가요? (예)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]여기에 질문 내용을 남겨주세요.프론트 p태그 관련 질문입니다.데이터를 집어 넣지 않고 단순하게 쓰는 p태그의 경우<p>인프런</p> 코드를 실행하면 인프런이 출력되는걸로 알고 있습니다. 강의를 듣다 호기심에 나이스 문자열을 추가해봤는데요나이스1은 타임리프 문법이 적용된 문장이고나이스는 단순한 p태그입니다.하지만 나이스1도 타임리프 관련 코드가 끝나고 괄호를 닫고 추가된 문자인데 왜 출력이 안 되는지 궁금합니다.
-
해결됨스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
윈도우 gradlew.bat build 에러 발생
Microsoft Windows [Version 10.0.22621.2861] (c) Microsoft Corporation. All rights reserved. C:\Users\Yoon\Desktop\CS\SpringStudy\hello-spring>gradlew build FAILURE: Build failed with an exception. * What went wrong: 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 FAILED in 5s 안녕하세요 어제 동일한 질문을 올렸었는데 파일의 권한을 수정하고 다시 올렸습니다.우선 저는 윈도우 사용자이고, java --version으로 확인해봐도 Java 17버전이고, 설정 가능한 모든 부분에서 17버전으로 바꿨는데도 에러가 발생합니다. 모든 방법을 시도해봐도 cmd에서 "gradlew build" 명령어를 치면 build failed라는 메시지가 출력됩니다. plugins { id 'java' id 'org.springframework.boot' version '3.2.1' id 'io.spring.dependency-management' version '1.1.4' } group = 'hello' version = '0.0.1-SNAPSHOT' java { sourceCompatibility = '17' } repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-web' testImplementation 'org.springframework.boot:spring-boot-starter-test' } tasks.named('test') { useJUnitPlatform() } 파일 링크: https://drive.google.com/file/d/1hnY1DJJ-9loR_mcQBum97NDgOErGgoMO/view?usp=sharing며칠째 이부분에서 막혀서 진도를 못 나가고 있습니다.. 도와주세요..ㅠㅠ------------------------------------------------------------------------------------------------java 17버전으로 설정해도 오류가 나시는 분들이 계시다면 아래 방법을 따라해보세요. 저는 이렇게 하니 해결되었습니다.인텔리제이 최신버전으로 재설치기존 JDK 삭제 후 최신버전으로 재설치 및 환경변수 등록 (재부팅 필수) 설치한 JDK를 프로젝트에 적용
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
섹션 5-2. JPA에서 em.createQuery(SQL) 질문
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]여기에 질문 내용을 남겨주세요. JPA에서 em.createQuery("select i from Item i", ...)을 쓰시는데 저 구문을 h2에 직접 날려보면 i 를 찾을 수 없다고 나오는데 select * from item을 안 쓰는 이유가 있나요?
-
미해결스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
ItemType 같이 enum 으로 관리되는게 변경의 여지가 있다면 코드테이블로 관리하는게 좋을까요?
ItemType 같이 enum 으로 관리되는게 변경의 여지가 있다면 어떻게 관리하는게 좋을지 생각해 봤는데요,상수를 따로 관리하는 테이블을 생성해서세션이나 캐시로 관리하는게 어떨까 싶은데 현업에선어떻게 관리되는지 궁금합니다.아무래도 세션보단 캐시가 더 효율적이겠죠?
-
해결됨스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
@ModelAttribute와 html/text에 대하여 질문이 있습니다.
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]여기에 질문 내용을 남겨주세요.컨버전 서비스는 @RequestParam, @ModelAttribute, @PathVariable, 뷰 템플릿에 적용된다는 내용에 궁금증이 생겨 질문을 드립니다. @ModelAttribute는 @RequestParam의 기능에서 객체를 생성하고 model에 담는 기능이 추가되었다고 생각했었습니다. 이렇게 객체가 생성될 때 컨버전 서비스가 작용되는 걸까요? 하지만, String을 다른 타입으로 바꾸어 받을 수 있는 @PathVariable이나 @RequestParam과는 달리 객체를 생성하거나 set하는 @ModelAttribute는 컨버전과 관계가 없게 느껴집니다. 어떤 경우 @ModelAttribute에도 컨버전 서비스가 적용되는 것인가요?html/form형식에서 post방식을 통해 http요청의 바디에 데이터가 들어온다고 학습하였습니다. 이때 데이터가 바디에있지만 @ResponseBody가 아닌 마치 get방식처럼 @RequestParam, @ModelAttribute을 이용해야 하는 것은 스프링의 api때문으로 이해하면 될까요?
-
미해결스프링부트 개념정리(이론)
클라이언트 요청 시 디스패쳐 서블릿 동작에 관해
안녕하세요! 먼저 좋은 강의 해주셔서 감사합니다.다름이 아니라, 강의 마지막 부분의 Spring 동작을 간단하게 설명해주셨는데요. 이 때, 클라이언트로부터 요청이 들어오면 디스패쳐 서블릿이 웹과 관련된 Controller들을 메모리에 올린다고 하셨는데, 스프링부트의 @Controller 어노테이션은 컴포넌트 스캔의 대상이고, 스프링부트 어플리케이션이 로드될 때 Application Context에 등록되는 것으로 알고 있습니다.본 강의에서 말씀해주신 내용과 제가 학습했던 내용에 차이가 있어 질문 드립니다. @Controller 어노테이션을 사용하는 스프링부트의 Controller는 컴포넌트 스캔을 통해 Service, Repository 등과 다른 시점에서 로드되는지말씀해주신 메모리에 올린다는 표현이 Application Context로부터 빈을 주입받는 것을 의미하는건지학습한 지 얼마 안되서 개념에 혼동이 오네요 ㅠ.ㅠ 다시 한번 좋은 강의 감사드립니다!
-
미해결스프링 핵심 원리 - 기본편
필드 주입 질문있습니다.
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)예3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)예[질문 내용]필드 주입은 외부에서 변경이 불가능해서 테스트하기 힘들다는 치명적인 단점이 있다고 하셨는데, 외부에서 변경이 불가능하다는게 정확히 무슨 의미인가요? 생성자 주입도 변경이 불가능하지 않나요?
-
미해결스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술
@RequestMapping 질문드립니다.
@RequestMapping만 붙인 기존 상태에서 postman으로 같은 url로 GET, POST 요청을 보내도 동일하게 성공하는 것을 확인했습니다. 근데 GET, POST만 되고, PUT, PATCH, DELETE는 안되더라구요. 혹시 GET, POST만 되는 다른 이유가 있을까요? 7:10 부터 관련 내용입니다!(밑에 AI 답변이 있긴하지만, 다른 질문에 대한 답변을 추천해준 것 같습니다)
-
해결됨스프링 DB 2편 - 데이터 접근 활용 기술
물리적인 트랜잭션을 처리하는 부분에 대해 헷갈리는 점이 있습니다.
안녕하세요.항상 강의잘 듣고있습니다!강의를 완강하고 복기하던 중에 궁금한 점이 있습니다. 강의에서는 커밋 또는 롤백을 하는 경우 트랜잭션 메니저로 요청을 보내 물리적인 부분을 처리한다 라고 학습했는데요, 가끔씩 강의를 듣다보면 트랜잭션 매니저 -> 트랜잭션 동기화 매니저 를 통해 물리적인 트랜잭션을 처리한다고 말씀하셔서 (스프링 트랜잭션 전파5 - 외부 롤백 6분 20초경)마지막 물리적으로 처리하는 부분이 트랜잭션 매니저단에서 끝나는지, 트랜잭션 매니저에서 트랜잭션 동기화 매니저를 통해 끝나는지 헷갈려서 질문남깁니다.! 감사합니다!!
-
해결됨실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
@Transactional 과 entityManager 범위에 관해 질문 드립니다.
안녕하세요! 강의 수강 중 질문이 생겨 작성합니다.. 답변 부탁드립니다..!ㅠ.ㅠ -- MemberRepository 입니다. ( @Transactional 키워드 모두 지움 )@Repository public class MemberRepository { @PersistenceContext EntityManager em; public Member findMember( Long id ) { Member member = em.find(Member.class, id); return member; } public Member findMember2( Long id ) { Member member = em.find(Member.class, id); return member; } } -- 위 레파지토리를 호출하는 테스트 코드 입니다. ( 데이터는 미리 넣어둔 상태 입니다. )@SpringBootTest class MemberRepositoryTest { @Autowired MemberRepository mRepo; @Test public void test2() { System.out.println("================================================="); System.out.println(mRepo.getClass()); //when Member found1 = mRepo.findMember(1L); Member found2 = mRepo.findMember2(1L); System.out.println("================================================="); //then assertEquals(found2, found1); } } 1 ) 테스트 코드에서 주입받은 mRepo의 클래스 타입을 확인하면 CGLIB로 생성한 프록시 클래스가 출력됩니다. 위 코드에서 보는 바와 같이 @Transactional 어노테이션은 존재하지 않는데도 실 클래스가 아닌 프록시 객체로 만들어지는 이유가 뭔가요?? 2 ) 테스트 코드에서 test2()를 실행하면 select를 2번 실행합니다. test2()에 @Transactional을 걸면 -> select 1번 -> 너무 당연한데MemberRepo 클래스 레벨에서 @Transactional -> 테스트 코드 실행 시 select 2번MemberRepo 클래스 각 메소드에 @Transactional -> 테스트 코드 실행 시 select 2번 2-1) 위와 같은 결과가 발생하는 이유를 모르겠습니다.. @Transactional을 어떻게 걸든 한 메소드가 종료하고 나면 PersistenceContext 가 닫히는 건가요?.. 2-2) MemberRepo 에서 주입받은 entityManager는 proxy 클래스가 맞는거죠..?@Transactional을 표기해주지 않아도, em을 사용하는 메소드가 호출되고 종료 될 때마다, 매번 proxy 객체 내부의 실제 entityManager 객체가 변경되는 건가요?? 2-3) em.find(Member.class, 1L) 같은 조회성 질의에서@Transactional(readOnly=true) 와 아예 해당 어노테이션을 사용하지 않았을 경우의 결과가 동일하였습니다. 그렇다면 readOnly를 사용하는 이유가 대체 무엇인가요?.. 질문이 많아서 죄송합니다 ㅠㅠ 머리에 정리가 되질 않아서요..답변 부탁드립니다!!
-
미해결스프링 핵심 원리 - 기본편
섹션6. 필터에서 beanA를 찾을 수 없음
@MyIncludeComponent public class BeanA { }@MyExcludeComponent public class BeanB { }package hello.core.scan.filter; import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.FilterType; import static org.assertj.core.api.Assertions.*; import static org.springframework.context.annotation.ComponentScan.*; public class ComponentFilterAppConfigTest { @Test void filterScan() { ApplicationContext ac = new AnnotationConfigApplicationContext(ComponentFilterAppConfig.class); BeanA beanA = ac.getBean("beanA", BeanA.class); assertThat(beanA).isNotNull(); } @Configuration @ComponentScan( includeFilters = @Filter(type = FilterType.ANNOTATION, classes = MyIncludeComponent.class), excludeFilters = @Filter(type = FilterType.ANNOTATION, classes = MyExcludeComponent.class) ) static class ComponentFilterAppConfig { } }강의와 똑같이 따라친 해당 코드에서 org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'beanA' available 에러가 계속 발생합니다. 그래서 아래 코드처럼 BeanA 클래스와 BeanB클래스에 @Component 애노테이션을 추가하였더니 잘 작동합니다. @MyIncludeComponent @Component public class BeanA { } @MyExcludeComponent @Component public class BeanB { } 그런데 이 경우에는 또 하단의 Assertions.thorws 검증 코드가 제대로 작동하지 않습니다. ㅠ .... assertThrows( NoSuchBeanDefinitionException.class, () -> ac.getBean("beanB", BeanB.class)); 그래서 하단 코드처럼 BeanA에만 @Component를 붙이고 BeanB에는 @Component를 붙이지 않으면 테스트 코드가 올바르게 작동합니다... 원인을 알 수 있을까요? @MyIncludeComponent @Component public class BeanA { }@MyExcludeComponent public class BeanB { } BeanA, BeanB, MyExcludeComponent, MyIncludeComponent, ComponentFilterAppConfigTest 모두 테스트의 filter 패키지에 있습니다.
-
미해결스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
th:class 부분 th:if /th: classappend
위 코드에서 th: class= ${errors?.containsKey('itemName')} ? ~~~ 를 if 조건식으로 참 거짓 구분하여 참이면 클래스 뒤에 append를 해주는 방식으로 해주었는데 이방식으로 하면 아예 상품명 공간이 사라지네요 ㅜ 다른방식으로도 해보고 싶은데 강사님이 알려주신 th:class 밖에 없는것일까요?타임리프 기본 문법을 다시 보면서 변형해보고있는데 잘 안되서요 😅 th:if="${errors?.containsKey('itemName')}" th:classappend="field error"
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
강의 자료 오타 제보합니다.
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오) 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 예3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) 예[질문 내용]3. 회원 관리 예제 - 백엔드 개발.pdf5번째 페이지MemoryMemberRepositoryTest 클래스의 save() 메서드 부분이 이렇게 되어 있습니다. 마지막 줄이 수정이 필요해 보입니다.@Test public void save() { //given Member member = new Member(); member.setName("spring"); //when repository.save(member); //then Member result = repository.findById(member.getId()).get(); (result).isEqualTo(member); }
-
미해결토비의 스프링 부트 - 이해와 원리
ApplicationRunner 가 동작하지 않는 이유
테스트 환경에서는 application.properties를 읽지 않고 ApplicationRunner가 동작하지 않는다고 하셨습니다. 그래서 @TestPropertySource로 설정 파일을 넣어줬는데요 이게 동작하지 않는 이유는 테스트 환경은 스프링을 확장해서 스프링 컨테이너를 띄우고 구성 정보 클래스를 집어넣어서 빈 오브젝트만 등록하기 때문이 맞을까요 ? SpringApplication.run은 테스트 환경과 다르게 스프링 컨테이너를 띄우고 템플릿 매서드로 컨테이너를 띄우고 구성 정보 클래스를 활용해서 빈 오브젝트를 등록하는 거 외에 추가적인 Ruuner 나 Property 파일을 읽는 작업을 별도로 하기 때문인거죠 ?
-
미해결스프링 핵심 원리 - 고급편
OrderControllerV1 인터페이스에 @RequestMapping 선언 시 404 not found 뜨시는 분들
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예[질문 내용]저와 같은 문제를 겪을까 포스팅 합니다.스프링 부트 3.2 버전 사용 중이며, @RequestMapping 어노테이션 사용 시에 404 not found가 반환될텐데, 해당 부분 @RestController로 변경 시 정상적으로 ok 반환됩니다.