https://drive.google.com/file/d/1PBHzDQJ0Odvh2KWMa_BTOu3PZqHrMJkj/view?usp=drive_link MemberRepositoryTest를 실행하면 이렇게 됩니다. junit5로 하고 있는데 이런식으로 오류가 발생합니다. JPA와 DB 설정, 동작확인 13분경까지 들었습니다. JpashopApplication를 실행해도 오류가 발생하기 시작했습니다.
제가 이해한 구조는 아래와 같습니다. Request -> API -> Service -> Entity Redis에서 캐시 조회 실패하면 redis에서 몽고 db collection 관련 함수를 직접 조회 하는 게 아니라 서비스로 돌아가서 서비스단에서 몽고 db collection 관련 함수를 호출하는게 맞지 않나요? 아니면 주신 코드 처럼 Entity 단에서는 서로를 호출하면서 작동하는게 맞나요?
안녕하세요. 문제점 해결하기 강의에서 실습을 잘 진행했습니다. 실험을 하며 결과를 관측하던 중, @NoArgsConstructor(access = AccessLevel.PROTECTED) @RequiredArgsConstructor @Entity public class Coupon { @Id @GeneratedValue private Long id; } 위와 같이 @GeneratedValue를 적용하면 로그패턴도 달라지고 성능이 급격하게 나빠지더라고요 @Id @GeneratedValue(strategy = GenerationType.IDENTITY) 로 지정하면 실습이 잘 진행됩니다. 왜 이런차이가 발생하는지 알 수 있을까요? strategy를 선택하지 않으면 AUTO이며 이는 mysql에서 IDENTITY를 선택한 것과 같게 나와야하는데 예상과 달라 질문드려봅니다.
상세페이지 href속성을 찾아 기존페이지 url?상세페이지 url을 적용하여 실습을 성공해 오다가 난관에 부딪혔습니다. html속성값을 보니 아래와 같이 되어 있고 url에 붙이거나 해도 페이지가 로드 되지 않아 어려움을 겪고 있습니다. <a href="Javascript:view_content('869');">처리 일정 문의 드립니다.</a> 위와같은 href가 나타날때는 어떻게 상세페이지로 이동해야 하는지 궁금하고 이럴때 혹시 우회할 수 있는 대안이 있다면 알고 싶어요
junt4로 gradle에서 설정하려고 하면 오류가 발생해서 juit5로 하는 중입니다. MemberRepositoryTest를 junit5버전으로 고쳐서 아래의 코드로 실행했는데 오류가 나고 있습니다 import jpabook.jpashop.Member; import jpabook.jpashop.MemberRepository; //import jpabook.jpashop.domain.Member; //import jpabook.jpashop.repository.MemberRepository; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; @ExtendWith(SpringExtension.class) // JUnit 5 방식 @SpringBootTest public class MemberRepositoryTest { @Autowired MemberRepository memberRepository; @Test @Transactional @Rollback(false) public void testMember() { Member member = new Member(); member.setUsername("memberA"); Long savedId = memberRepository.save (member); Member findMember = memberRepository.find(savedId); Assertions.assertThat(findMember.getId()).isEqualTo(member.getId()); Assertions.assertThat(findMember.getUsername()).isEqualTo(member.getUsername()); Assertions.assertThat(findMember).isEqualTo(member); // JPA 엔티티 동일성 보장 } } 밑에는 오류입니다. Unable to find a @SpringBootConfiguration by searching packages upwards from the test. You can use @ContextConfiguration, @SpringBootTest(classes=...) or other Spring Test supported mechanisms to explicitly declare the configuration classes to load. Classes annotated with @TestConfiguration are not considered. java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration by searching packages upwards from the test. You can use @ContextConfiguration, @SpringBootTest(classes=...) or other Spring Test supported mechanisms to explicitly declare the configuration classes to load. Classes annotated with @TestConfiguration are not considered. at org.springframework.util.Assert.state(Assert.java:79) 1. @SpringBootTest(classes=...) 로 명시적으로 설정 클래스 지정 2. @SpringBootApplication 이 있는 클래스의 위치 확인 3. @ContextConfiguration 을 사용해서 명시적으로 설정 클래스 지정 이세가지를 시도해도 안되고 있습니다. 아니면 juni4룰 사용해야만 할까요? build.gradle에 JUnit4 추가 testImplementation("org.junit.vintage:junit-vintage-engine") { exclude group: "org.hamcrest", module: "hamcrest-core" } 를 하면 Build file 'C:\Users\Peter\Desktop\study\jpashop\build.gradle' line: 45 A problem occurred evaluating root project 'jpashop'. > Could not find method testImplementation() for arguments [org.junit.vintage:junit-vintage-engine, build_55eer8btj8rd1l6xp0yqapa0y$_run_closure6@6e20627f] on root project 'jpashop' of type org.gradle.api.Project. 라고 나옵니다.
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2025-02-13T00:15:43.156+09:00 ERROR 7780 --- [ main] o.s.boot.SpringApplication : Application run failed Error creating bean with name 'entityManagerFactory' 이런 오류가 뜹니다 쿼리가 안 만들어져요 이오류 때문에 ㅜ
[질문 템플릿] 1. 강의 내용과 관련된 질문인가요? 예 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예 3. 질문 잘하기 메뉴얼을 읽어보셨나요? [질문 내용] PPT 양방향 매핑에서 테이블연관관계를 나타낼때 TEAM의 PK가 MEMBER의 FK 로 존재한다면 실선이 아닌 점선으로 표현되어야 하는 것 아닌가요 ? MEMBER의 경우 TEAM_ID가 PK가 아니니까 null을 허용할 수 있으니 팀이 없는 경우가 존재할 테니까 멤버가 팀을 가지고 있는 것은 선택적인 관계로 점선으로 표현해야하는 것이 아닌가 싶습니다
19:49:22.386 [main] INFO org.springframework.test.context.support .AnnotationConfigContextLoaderUtils -- Could not detect default configuration classes for test class [com.mysite.sbb.SbbApplicationTests]: SbbApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration. console에 위와 같은 문구가 나오고 아래로 실행 문구가 뜨지 않습니다.
안녕하세요. sorting 파트의 문제 4번 심사위원 문제의 시간복잡도 질문입니다. 정답 코드에서 score를 순회하며 getAve 함수를 호출하면서 이중 for문이 실행됩니다. score의 최대 길이가 30만이고, k가 최대 10만이므로 시간 복잡도는 O(nk)입니다. 최악의 경우 30만 × 10만 = 300억 번 연산이 발생하는데, 이는 1~2초의 제한 시간 내에 절대 수행될 수 없으므로 시간 초과가 발생하는 코드가 맞나요? 또한 제 풀이도 평가 부탁드립니다. 누적합 배열을 사용해서 풀어봤습니다. 이러면 시간복잡도가 O(nlogn)이 나와서, 최악의 경우라도 O(90만)이라고 계산했는데, 맞을까요? import java.util.*; class Solution { public int solution(int[] score, int k){ int answer = 0, n = score.length; Arrays.sort(score); //pre: 누적합 배열 int[] pre = new int[n]; pre[0] = score[0]; //누적합 구하기 for(int i = 1; i < n; i++){ pre[i] = pre[i-1] + score[i]; } //score 순회하면서, 조건 만족하면 누적합 배열로 평균 구하기 for(int i = 0; i <= n - k; i++){ if(score[i + k - 1] - score[i] <= 10){ int tmp; if(i == 0){ tmp = pre[i + k - 1]; }else{ tmp = pre[i + k - 1] - pre[i - 1]; } tmp /= k; //평균 answer = tmp; break; } } return answer; } public static void main(String[] args){ Solution T = new Solution(); System.out.println(T.solution(new int[]{99, 97, 80, 91, 85, 95, 92}, 3)); System.out.println(T.solution(new int[]{92, 90, 77, 91, 70, 83, 89, 76, 95, 92}, 4)); System.out.println(T.solution(new int[]{77, 88, 78, 80, 78, 99, 98, 92, 93, 89}, 5)); System.out.println(T.solution(new int[]{88, 99, 91, 89, 90, 72, 75, 94, 95, 100}, 5)); } }
for i in range(10): print(i) if i < 5: continue elif i == 7: break 여기서 출력값이 01234567이 나왔는데 567이 나오는건 이해하겠는데 0부터 4는 if구문의 continue 때문에 건너뛰어야하는것 아닌가요..? 왜 이렇게 출력이 되는지 궁금해요
1. 강의 내용과 관련된 질문인가요? 예 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예 3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예 안녕하세요 지역 클래스 부분을 수강하다 궁금한 점이 있어 여쭤봅니다. 지역 클래스 파트의 코드를 확인하면 Printer process라는 메서드 안 return printer; 바로 위에 LocalPrinter printer = new LocalPrinter(); 이라는 코드가 강의에서 나옵니다. 그런데 제공해주신 강의 자료에는 해당 부분이 Printer printer = new LocalPrinter();로 형이 다르던데 혹시 이것은 오타일까요 ? 익명 클래스를 수강하다 다른 점이 있어 되돌아와서 찾아보는 중이었습니다 ! 좋은 강의 제공해주셔서 감사합니다 !!
RabbitMQ도 충분히 강력한 기능을 제공하는 것으로 보입니다. 근데 이제 한번 소비한 메시지는 소비하면서 어딘가에 또 저장하지 않는 이상 재시도가 어려운것으로 알고있습니다. 현업에서 RabbitMQ를 도입하시고 사용하시면서 Kafka의 어떤 토픽의 0번 오프셋부터 읽기(earliest)같은 요구사항이 있었던 적은 없으셨는지 궁금합니다!
안녕하세요. "조회수 어뷰징 방지 정책 구현" 강의의 ViewApiTest.viewTesst를 실행한 다음 redis가 동작하는 docker에 접속해 redis-cli를 실행하고 "keys *" 명령어를 실행하면, distributed lock이나 조회수에 관련된 key를 찾을 수 없습니다. database 0~15를 돌며 "keys *"를 실행 했을 때 (empty array)를 응답 받고 있습니다. 어떤 방법으로 결과를 확인할 수 있을까요?