inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

도메인 객체와 엔티티 객체 분리 시 객체 그래프 탐색 관련 질문

해결됨

자바 ORM 표준 JPA 프로그래밍 - 기본편

안녕하세요. 김영한 선생님의 강의를 참 잘 보고 있는 학생입니다. SQL 중심적인 개발의 문제점 편에서, 객체지향 프로그래밍에서 객체는 자유롭게 객체 그래프를 탐색할 수 있어야하 지만 SQL로 개발하는 경우에는 처음 실행하는 SQL에 따라 탐색 범위가 결정된다 는 문제가 있다고 말씀하셨습니다. 그리고 엄격한 도메인 주도 설계의 관점에서는 '도메인 객체'와 '엔티티 객체'를 분리 해야 한다고 알고 있습니다. 비즈니스 로직을 다루는 도메인 객체가 JPA 라고 하는 기술에 의존하는 것은 영 즐거운 일은 아니기 때문이죠.. ( https://stackoverflow.com/questions/24703756/having-separate-domain-model-and-persistence-model-in-ddd ) 그렇기 때문에 도메인 객체와 엔티티 객체를 분리하게 된다면 Repository 계층에서 예를 들어 findById 를 했을 경우 엔티티 객체를 도메인 객체로 매핑해서 돌려주어야 합니다. 그런데 이럴 경우, 기존의 SQL로 개발하는 경우와 비슷한 문제가 발생하게 되는 것 같습니다. 매핑을 어디까지해서 돌려주어야 하느냐는 점이죠. Member 를 조회했을 때, 객체 그래프 안에 있는 Category까지 싹싹 다 조회해와서 매핑을 해주기도 곤란한 노릇이고, MemberWithTeam , MemberWithOrderAndOrderItem... 와 같은 객체를 따로 따로 만드는 것도 요상해보입니다. 그렇다고 객체 그래프를 다 끊어놓자니 그것도 객체지향적이지 않은 것 같아보이구요.. 이런 상황에서는 어떤 식으로 도메인 객체를 설계하는지, 엔티티 객체의 매핑은 어떤 방법으로 이루어지는지가 너무 궁금합니다.

  • java
  • jpa
  • ddd
Octoping 댓글 1 좋아요 1 조회수 909

강사님 질문입니다!

미해결

스프링 프레임워크는 내 손에 [스프2탄]

저는 페이징과 검색위주로 보고자 이 강의를 구매하게되었습니다. 프로젝트 진행중이라서 게시판이나 답글은 많이 해봤어서 페이징으로 넘어가고싶은데.. 이럴려면 페이징 이전의소스가 필요해서요.. 프로젝트가 만히 급해서.. 혹시 회차별로 소스코드제공이 가능할까요? ㅠㅠ..

  • spring
  • jquery
  • mvc
  • jpa
  • spring-security
qkrtngus116 댓글 2 좋아요 0 조회수 455

9:27 에 나오는 부분 찾아봤습니다.

해결됨

호돌맨의 요절복통 개발쇼 (SpringBoot, Vue.JS, AWS)

public static MockHttpServletRequestBuilder get(String urlTemplate, Object... urlVariables) { return MockMvcRequestBuilders.get(urlTemplate, urlVariables) .requestAttr(RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE, urlTemplate); } 위의 코드는 RestDocumentationRequestBuilders의 get()입니다. Spring REST Docs2 - 요청, 응답필드의 9:27에서 하신 말씀 듣고 상속 관계이지 않을까하는 생각이 들었고 궁금해서 들어가보니 상속이 아닌 RestDocumentationRequestBuilders의 get()에서 내부적으로 MockMvcRequestBuilders의 get()를 호출해주더라구요. MockMvcRequestBuilders가 추상클래스지만 get()이 static으로 선언되어 있어 상속을 해도 오버라이드를 할 수 없기에 저런 식으로 만들었지 않았을까? 라고 추측을 해봤습니다. 그러면서 추가적으로 위의 클래스들이 추상클래스로 만들어져 있고 메소드가 전부 static으로 선언되어 있는 것에 대해 이유가 궁금했습니다. 추상클래스는 추상 메소드를 선언하고 상속을 하면서 오버라이드를 통한 다형성을 위해 사용한다고 알고 있었는데 여기서는 다른 목적과 방식으로 사용하고 있는 것처럼 보였기 때문입니다. 그래서 검색을 해봤지만 키워드를 잘못 선택했는지 명확하게 답을 찾지는 못했고, 추상 클래스와 스태틱 메소드에 대해 각각 찾아보면서 "객체 생성 제한과 메모리 이득 때문인가?" 라는 생각이 들더라구요. 하지만 추상클래스도 익명객체를 사용하면 객체 생성이 가능해지는 걸로 아는데 그래서인지RestDocumentationRequestBuilders는 생성자도 private으로 선언해 익명 객체로도 생성이 안되게 막아 놨지만 MockMvcRequestBuilders같은 경우는 생성자를 따로 막아 놓지 않아서 익명 객체로 생성이 가능하더라구요. 이렇게 차이를 두는 이유는 뭔가요?? 그리고 위의 클래스들처럼 선언한 이유도 궁금합니다.

  • vue.js
  • aws
  • spring-boot
  • jpa
  • spring-security
100end 댓글 1 좋아요 1 조회수 684

rest일때만 무한 루프 도는 이유가 궁금합니다.

미해결

실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화

학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 예 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 예 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) 예 [질문 내용] 그냥 컨트롤러에서 model에 담아서 조회할떄는 무한루프가 안도는데 json으로 반환할떄는 왜 무한로프 도는지가 궁금합니다.

  • java
  • spring
  • spring-boot
  • jpa
maurizio 댓글 2 좋아요 2 조회수 644

회원수정 프로파일 컨트롤러에서 수정하신부분

미해결

스프링 프레임워크는 내 손에 [스프1탄]

폼에서 히든으로 프로파일 넘겨버려도 될까요? 저만 안되는줄 알고 그렇게 처리했더니 정상작동하길래 혹시나 나중에 안좋은 코드일까해서 여쭈어봅니다!

  • jsp
  • spring
  • mvc
  • spring-security
xldals 댓글 1 좋아요 0 조회수 346

AbstractAuthenticationProcessingFilter내에서 HttpServletResponse값이 안들어갑니다

해결됨

호돌맨의 요절복통 개발쇼 (SpringBoot, Vue.JS, AWS)

@Bean public SecurityFilterChain httpSecurity(HttpSecurity http) throws Exception { return http.cors().disable() .csrf().disable() .httpBasic().disable() .formLogin().disable() .authorizeRequests().anyRequest().authenticated() .and() .addFilterAt(authFilter(), UsernamePasswordAuthenticationFilter.class) .addFilterAt(jwtFilter(), UsernamePasswordAuthenticationFilter.class) .build(); } @Bean public WebSecurityCustomizer webSecurityCustomizer() { return web -> { web.ignoring().requestMatchers().antMatchers("/h2/**"); }; } @Bean public AuthFilter authFilter() throws Exception { var authFilter = new AuthFilter(); authFilter.setAuthenticationManager(authenticationConfiguration.getAuthenticationManager()); authFilter.setAuthenticationSuccessHandler(new SimpleUrlAuthenticationSuccessHandler("/")); authFilter.setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler("/error")); return authFilter; } 설정은 위와 같이 했습니다. @Override protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authResult) throws IOException, ServletException { super.successfulAuthentication(request, response, chain, authResult); String SECRET = "secrsdkfjhjh4243j234jh2SDdsfjhgsdfhjgjFQQQQdasd1et"; Claims claims = Jwts.claims(); claims.put("username", SecurityContextHolder.getContext().getAuthentication().getName()); String compact = Jwts.builder() .setClaims(claims) .setIssuedAt(new Date(System.currentTimeMillis())) .setExpiration(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 10)) // 1시간 .signWith(SignatureAlgorithm.HS256, SECRET) .compact(); response.addHeader("Authorization", compact); response.addCookie(new Cookie("token", compact)); } 위와 같이 설정을 했는데 http 요청 테스트를 해보면 설정한 값이 하나도 들어가 있지않습니다. 컨트롤러나 OncePerRequestFilter에서 값을 넣어보면 잘 적용됩니다..

  • vue.js
  • aws
  • spring-boot
  • jpa
  • spring-security
godrn1993 댓글 2 좋아요 1 조회수 782

AWS 과금 조심!

미해결

호돌맨의 요절복통 개발쇼 (SpringBoot, Vue.JS, AWS)

질문글은 아니지만 혹시 저처럼 AWS랑 안 친하신 분들을 위해 과금 조심하시라고 올립니다. 강의 내용에도 설명 해주시지만, 고정IP(아마존에서는 Elastic IP Addresses, 탄력적 IP라고 부르네요)를 생성하고 인스턴스를 연결 안 하거나, 연결된 인스턴스가 running상태가 아니면 하루에 0.12USD정도 나가는 것 같네요. (저는 인스턴스에 연결만 해두면 되는 줄 알고 연결된 인스턴스 꺼놨다가 요금 나갔네요ㅜ.. 수업료가 그나마 싸서 다행입니다. ) AWS 강의까지 진행하시는 분들은 참고하셔서 진행하시면 좋을 것 같아요!

  • vue.js
  • aws
  • spring-boot
  • jpa
  • spring-security
고래밥 댓글 1 좋아요 5 조회수 1052

JPA 소개 - 1차 캐시와 동일성 보장 에서 질문이 있습니다!

미해결

자바 ORM 표준 JPA 프로그래밍 - 기본편

학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] 안녕하세요, 영한님! 영한님 수업을 새겨듣고 있는 수강자입니다! 다름이 아니라, JPA 소개파트의 "1차 캐시와 동일성 보장(15분 30초경)" 에서 말씀하신 동일성이 "각 Entity가 참조하는 메모리 주소가 같지 않아도 값을 통해 같음을 보장"한다는 뜻과 일맥상통한 내용인가요? Java의 equals에 대해서 공부하다가 동일성이란 단어가 동일한 의미로 쓰이는지 궁금해서 여쭈어봐요! 만약에 같은 뜻이라면, "같은 엔티티를 반환한다"는 말을 "참조하는 메모리 주소가 같지는 않고, 값만 같은 엔티티를 반환한다"로 이해해도 될까요?? 질문 들어주셔서 감사합니다. 오늘도 좋은 하루 보내세요!!

  • java
  • jpa
윤수정 댓글 1 좋아요 0 조회수 661

jquery 버전차이로 이미지가 안보일수도 있나요?

해결됨

스프링 프레임워크는 내 손에 [스프1탄]

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 이미지 경로도 정확한데도 불구하고 이미지가 뜨지않아서 깃에 올려두신 코드의 상단부분만 복사 붙여넣기하여 이미지가 뜨게 바꿨는데 제 기존 코드와 비교해보니 jquery의 버전이 다르더라구요 단순히 버전차이일까요?

  • jsp
  • spring
  • mvc
  • spring-security
xldals 댓글 1 좋아요 0 조회수 483

테스트(Matchers.is) 질문드립니다.

미해결

호돌맨의 요절복통 개발쇼 (SpringBoot, Vue.JS, AWS)

.andExpect(MockMvcResultMatchers.jsonPath("$.length()").value(Matchers.is(2))) 위 코드와 아래코드 모두 정상적으로 통과하는걸 확인하였는데요 .andExpect(MockMvcResultMatchers.jsonPath("$.length()").value(2)) 수업에서는 Matchers.is() 를 사용하셨는데 위 코드 문맥에서 is() 를 굳이 왜 사용하셨는지 궁금해서 질문드립니다.

  • vue.js
  • aws
  • spring-boot
  • jpa
  • spring-security
falsystack 댓글 1 좋아요 2 조회수 587

Chap7 퀴즈

해결됨

나도코딩의 자바 기본편 - 풀코스 (20시간)

안녕하세요! 7강 마무리 퀴즈를 스스로 풀어보며 의문점이 생겨 질문 남깁니다. 저는 이런식으로 name 변수를 선언하고 cook() 메소드에 this.name을 활용했는데, 강의에선 기본 생성자와 name을 매개변수로 하는 생성자를 정의하고 풀어 주셨더라구요! 결과는 같게 나오지만 혹시 생성자를 사용하는게 더 좋은 코딩 방법인지, 제가 한 방식이 결과는 맞지만 논리적 오류가 있는지 궁금합니다. 그리고 강의 잘 듣고 있습니다. 감사합니다!

  • java
  • 객체지향
andy15948 댓글 1 좋아요 0 조회수 176

9:03쯤에 프로그램 실행 후 갑자기 브레이크 포인트가 잡히는 이유

미해결

스프링 시큐리티

브레이킹 포인트 잡는것도 생략하시고, 이건 강사님께서 매번 그러시는것 같고, 제가 여쭤보고싶은건 지금 form에다가 아이디와 패스워드를 입력하고 로그인 버튼 누른과정을 생략하시고 브레이킹 포인트가 잡힌부분이 갑자기 보이게끔 편집을 하신건가요??

  • java
  • spring-boot
  • spring-security
김태희 댓글 1 좋아요 0 조회수 434

jwt 로그인시 패스워드 검증

미해결

스프링부트 시큐리티 & JWT 강의

JWT 로그인 부분에서 username만 검증하고 password는 검증하는 부분이 안보이는거 같은데 맞나요? @Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException { System.out.println("UsernamePasswordAuthenticationFilter :: JwtAuthenticationFilter()"); // 1. id, pw 받아서 try { // x-www-form-urlencoded 로 요청시 // BufferedReader br = request.getReader(); // String input = null; // while((input = br.readLine()) != null){ // System.out.println(input); // } // System.out.println(request.getInputStream().toString()); // json 으로 요청시 ObjectMapper om = new ObjectMapper(); User user = om.readValue(request.getInputStream(), User.class); // 토큰 만들기 UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getUsername(), user.getPassword()); // PrincipalDetailsService의 loadUserByUsername() 이 실행된 후 정상이면 Authentication이 리턴됨 // DB에 있는 username과 password가 일치한다. Authentication authentication = authenticationManager.authenticate(authenticationToken); // 매니져가 인증을해서 Authentication 객체를 만들어줌 PrincipalDetails principalDetails = (PrincipalDetails) authentication.getPrincipal(); // System.out.println("ㅍㅍㅍ " + principalDetails.getUser().getUsername()); // 이게 조회가 된다는건 로그인 됫다는뜻 // System.out.println("---------------------------------"); // authentication 객체가 Security session 영역에 저장을 해야하고 그방법이 return return authentication; } catch (IOException e) { e.printStackTrace(); // 에러낫을때 떠넘겨 버리면 밑에 코드가 unreacheable 되서 컴파일 에러 } // 2. 정상인지 로그인 시도를 authenticationManager로 하면 PrincipalDetailsService loadUserByUsername() 가 실행됨 // 3. PrincipalDetails 를 세션에 담고 => 세션에 값이 있어야 권한 관리가 된다. (권한관리 안할거면 세션에 안담아도 됨) // 4. JWT 토큰을 만들어서 응답해주면 // System.out.println("================================"); return null; } 사용자 입력(username, password)만 받아서 검증없이 Authentication 객체 만들고 있고 @Service @RequiredArgsConstructor public class PrincipalDetailsService implements UserDetailsService { private final UserRepository userRepository; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { System.out.println("PrincipalDetaiilsService :: loadUserByUsername()"); User userEntity = userRepository.findByUsername(username); System.out.println("DB Connection :: UserRepository"); return new PrincipalDetails(userEntity); } } loadUserByUsername 에서도 username 만 받아서 엔티티 생성하는데 어디서 password 검증도 하는건지 궁금합니다.

  • spring
  • spring-security
  • jwt
Universe New 댓글 1 좋아요 0 조회수 1136

querydsl 테스트시 에러입니다.

미해결

실전! Querydsl

<code> 17:02:50.381 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate] 17:02:50.391 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support .DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)] 17:02:50.427 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [study.querydsl.QuerydslBasicTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper] 17:02:50.439 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [study.querydsl.QuerydslBasicTest], using SpringBootContextLoader 17:02:50.443 [main] DEBUG org.springframework.test.context.support .AbstractContextLoader - Did not detect default resource location for test class [study.querydsl.QuerydslBasicTest]: class path resource [study/querydsl/QuerydslBasicTest-context.xml] does not exist 17:02:50.444 [main] DEBUG org.springframework.test.context.support .AbstractContextLoader - Did not detect default resource location for test class [study.querydsl.QuerydslBasicTest]: class path resource [study/querydsl/QuerydslBasicTestContext.groovy] does not exist 17:02:50.444 [main] INFO org.springframework.test.context.support .AbstractContextLoader - Could not detect default resource locations for test class [study.querydsl.QuerydslBasicTest]: no resource found for suffixes {-context.xml, Context.groovy}. 17:02:50.445 [main] INFO org.springframework.test.context.support .AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [study.querydsl.QuerydslBasicTest]: QuerydslBasicTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration. 17:02:50.482 [main] DEBUG org.springframework.test.context.support .ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [study.querydsl.QuerydslBasicTest] 17:02:50.541 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [C:\Users\alita\Desktop\querydsl\querydsl\out\production\classes\study\querydsl\QuerydslApplication.class] 17:02:50.542 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration study.querydsl.QuerydslApplication for test class study.querydsl.QuerydslBasicTest 17:02:50.646 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [study.querydsl.QuerydslBasicTest]: using defaults. 17:02:50.646 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support .DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.event.ApplicationEventsTestExecutionListener, org.springframework.test.context.support .DependencyInjectionTestExecutionListener, org.springframework.test.context.support .DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener] 17:02:50.664 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@3a1dd365, org.springframework.test.context.support .DirtiesContextBeforeModesTestExecutionListener@395b56bb, org.springframework.test.context.event.ApplicationEventsTestExecutionListener@256f8274, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@68044f4, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@52d239ba, org.springframework.test.context.support .DirtiesContextTestExecutionListener@315f43d5, org.springframework.test.context.transaction.TransactionalTestExecutionListener@68fa0ba8, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@6c5945a7, org.springframework.test.context.event.EventPublishingTestExecutionListener@2f05be7f, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@640f11a1, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@5c10f1c3, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@7ac2e39b, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@78365cfa, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@64a8c844, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@3f6db3fb] 17:02:50.668 [main] DEBUG org.springframework.test.context.support .AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@424fd310 testClass = QuerydslBasicTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@1a45193b testClass = QuerydslBasicTest, locations = '{}', classes = '{class study.querydsl.QuerydslApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@1e13529a, org.springframework.boot.test.autoconfigure.properties .PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@93081b6, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@16c069df, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@7c3fdb62, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@4d6025c5, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@80ec1f8], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null]. . ____ _ /\\ / ___'_ __ ( _)_ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.7.12) 2023-06-26 17:02:51.012 INFO 16528 --- [ main] study.querydsl.QuerydslBasicTest : Starting QuerydslBasicTest using Java 11.0.15 on DESKTOP-UKCCBE9 with PID 16528 (started by alita in C:\Users\alita\Desktop\querydsl\querydsl) 2023-06-26 17:02:51.013 INFO 16528 --- [ main] study.querydsl.QuerydslBasicTest : No active profile set, falling back to 1 default profile: "default" 2023-06-26 17:02:51.530 INFO 16528 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2023-06-26 17:02:51.544 INFO 16528 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 7 ms. Found 0 JPA repository interfaces. 2023-06-26 17:02:52.025 INFO 16528 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2023-06-26 17:02:52.079 INFO 16528 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.15.Final 2023-06-26 17:02:52.234 INFO 16528 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations { 5.1.2.Final } 2023-06-26 17:02:52.480 INFO 16528 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2023-06-26 17:02:52.647 INFO 16528 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2023-06-26 17:02:52.678 INFO 16528 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect 2023-06-26 17:02:53.242 DEBUG 16528 --- [ main] org.hibernate.SQL : alter table member drop foreign key FKcjte2jn9pvo9ud2hyfgwcja0k Hibernate: alter table member drop foreign key FKcjte2jn9pvo9ud2hyfgwcja0k 2023-06-26 17:02:53.256 DEBUG 16528 --- [ main] org.hibernate.SQL : drop table if exists hello Hibernate: drop table if exists hello 2023-06-26 17:02:53.260 DEBUG 16528 --- [ main] org.hibernate.SQL : drop table if exists hibernate_sequence Hibernate: drop table if exists hibernate_sequence 2023-06-26 17:02:53.266 DEBUG 16528 --- [ main] org.hibernate.SQL : drop table if exists member Hibernate: drop table if exists member 2023-06-26 17:02:53.270 DEBUG 16528 --- [ main] org.hibernate.SQL : drop table if exists team Hibernate: drop table if exists team 2023-06-26 17:02:53.275 DEBUG 16528 --- [ main] org.hibernate.SQL : create table hello ( id bigint not null, primary key (id) ) engine=InnoDB Hibernate: create table hello ( id bigint not null, primary key (id) ) engine=InnoDB 2023-06-26 17:02:53.286 DEBUG 16528 --- [ main] org.hibernate.SQL : create table hibernate_sequence ( next_val bigint ) engine=InnoDB Hibernate: create table hibernate_sequence ( next_val bigint ) engine=InnoDB 2023-06-26 17:02:53.296 DEBUG 16528 --- [ main] org.hibernate.SQL : insert into hibernate_sequence values ( 1 ) Hibernate: insert into hibernate_sequence values ( 1 ) 2023-06-26 17:02:53.297 DEBUG 16528 --- [ main] org.hibernate.SQL : create table member ( member_id bigint not null, age integer not null, username varchar(255), team_id bigint, primary key (member_id) ) engine=InnoDB Hibernate: create table member ( member_id bigint not null, age integer not null, username varchar(255), team_id bigint, primary key (member_id) ) engine=InnoDB 2023-06-26 17:02:53.309 DEBUG 16528 --- [ main] org.hibernate.SQL : create table team ( id bigint not null, name varchar(255), primary key (id) ) engine=InnoDB Hibernate: create table team ( id bigint not null, name varchar(255), primary key (id) ) engine=InnoDB 2023-06-26 17:02:53.317 DEBUG 16528 --- [ main] org.hibernate.SQL : alter table member add constraint FKcjte2jn9pvo9ud2hyfgwcja0k foreign key (team_id) references team (id) Hibernate: alter table member add constraint FKcjte2jn9pvo9ud2hyfgwcja0k foreign key (team_id) references team (id) 2023-06-26 17:02:53.342 INFO 16528 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2023-06-26 17:02:53.351 INFO 16528 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2023-06-26 17:02:53.538 WARN 16528 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2023-06-26 17:02:54.098 INFO 16528 --- [ main] study.querydsl.QuerydslBasicTest : Started QuerydslBasicTest in 3.391 seconds (JVM running for 4.357) 2023-06-26 17:02:54.207 INFO 16528 --- [ main] o.s.t.c.transaction.TransactionContext : Began transaction (1) for test context [DefaultTestContext@424fd310 testClass = QuerydslBasicTest, testInstance = study.querydsl.QuerydslBasicTest@4504a4ed, testMethod = startQuerydsl@QuerydslBasicTest, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@1a45193b testClass = QuerydslBasicTest, locations = '{}', classes = '{class study.querydsl.QuerydslApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@1e13529a, org.springframework.boot.test.autoconfigure.properties .PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@93081b6, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@16c069df, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@7c3fdb62, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@4d6025c5, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@80ec1f8], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true, 'org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]]; transaction manager [org.springframework.orm.jpa.JpaTransactionManager@250e8712]; rollback [true] 2023-06-26 17:02:54.308 DEBUG 16528 --- [ main] org.hibernate.SQL : select next_val as id_val from hibernate_sequence for update Hibernate: select next_val as id_val from hibernate_sequence for update 2023-06-26 17:02:54.328 DEBUG 16528 --- [ main] org.hibernate.SQL : update hibernate_sequence set next_val= ? where next_val=? Hibernate: update hibernate_sequence set next_val= ? where next_val=? 2023-06-26 17:02:54.355 DEBUG 16528 --- [ main] org.hibernate.SQL : select next_val as id_val from hibernate_sequence for update Hibernate: select next_val as id_val from hibernate_sequence for update 2023-06-26 17:02:54.356 DEBUG 16528 --- [ main] org.hibernate.SQL : update hibernate_sequence set next_val= ? where next_val=? Hibernate: update hibernate_sequence set next_val= ? where next_val=? 2023-06-26 17:02:54.359 DEBUG 16528 --- [ main] org.hibernate.SQL : select next_val as id_val from hibernate_sequence for update Hibernate: select next_val as id_val from hibernate_sequence for update 2023-06-26 17:02:54.359 DEBUG 16528 --- [ main] org.hibernate.SQL : update hibernate_sequence set next_val= ? where next_val=? Hibernate: update hibernate_sequence set next_val= ? where next_val=? 2023-06-26 17:02:54.362 DEBUG 16528 --- [ main] org.hibernate.SQL : select next_val as id_val from hibernate_sequence for update Hibernate: select next_val as id_val from hibernate_sequence for update 2023-06-26 17:02:54.363 DEBUG 16528 --- [ main] org.hibernate.SQL : update hibernate_sequence set next_val= ? where next_val=? Hibernate: update hibernate_sequence set next_val= ? where next_val=? 2023-06-26 17:02:54.365 DEBUG 16528 --- [ main] org.hibernate.SQL : select next_val as id_val from hibernate_sequence for update Hibernate: select next_val as id_val from hibernate_sequence for update 2023-06-26 17:02:54.365 DEBUG 16528 --- [ main] org.hibernate.SQL : update hibernate_sequence set next_val= ? where next_val=? Hibernate: update hibernate_sequence set next_val= ? where next_val=? 2023-06-26 17:02:54.367 DEBUG 16528 --- [ main] org.hibernate.SQL : select next_val as id_val from hibernate_sequence for update Hibernate: select next_val as id_val from hibernate_sequence for update 2023-06-26 17:02:54.368 DEBUG 16528 --- [ main] org.hibernate.SQL : update hibernate_sequence set next_val= ? where next_val=? Hibernate: update hibernate_sequence set next_val= ? where next_val=? 2023-06-26 17:02:54.409 INFO 16528 --- [ main] o.s.t.c.transaction.TransactionContext : Rolled back transaction for test: [DefaultTestContext@424fd310 testClass = QuerydslBasicTest, testInstance = study.querydsl.QuerydslBasicTest@4504a4ed, testMethod = startQuerydsl@QuerydslBasicTest, testException = java.lang.NullPointerException, mergedContextConfiguration = [WebMergedContextConfiguration@1a45193b testClass = QuerydslBasicTest, locations = '{}', classes = '{class study.querydsl.QuerydslApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@1e13529a, org.springframework.boot.test.autoconfigure.properties .PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@93081b6, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@16c069df, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@7c3fdb62, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@4d6025c5, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@80ec1f8], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true, 'org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]] java.lang.NullPointerException at study.querydsl.QuerydslBasicTest.startQuerydsl( QuerydslBasicTest.java:57 ) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:62 ) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:43 ) at java.base/java.lang.reflect.Method.invoke( Method.java:566 ) at org.junit.platform.commons.util.ReflectionUtils.invokeMethod( ReflectionUtils.java:725 ) at org.junit.jupiter.engine.execution.MethodInvocation.proceed( MethodInvocation.java:60 ) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed( InvocationInterceptorChain.java:131 ) at org.junit.jupiter.engine.extension.TimeoutExtension.intercept( TimeoutExtension.java:149 ) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod( TimeoutExtension.java:140 ) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod( TimeoutExtension.java:84 ) at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0( ExecutableInvoker.java:115 ) at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0( ExecutableInvoker.java:105 ) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed( InvocationInterceptorChain.java:106 ) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed( InvocationInterceptorChain.java:64 ) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke( InvocationInterceptorChain.java:45 ) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke( InvocationInterceptorChain.java:37 ) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke( ExecutableInvoker.java:104 ) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke( ExecutableInvoker.java:98 ) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7( TestMethodTestDescriptor.java:214 ) at org.junit.platform.engine.support .hierarchical.ThrowableCollector.execute( ThrowableCollector.java:73 ) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod( TestMethodTestDescriptor.java:210 ) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute( TestMethodTestDescriptor.java:135 ) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute( TestMethodTestDescriptor.java:66 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.lambda$executeRecursively$6( NodeTestTask.java:151 ) at org.junit.platform.engine.support .hierarchical.ThrowableCollector.execute( ThrowableCollector.java:73 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.lambda$executeRecursively$8( NodeTestTask.java:141 ) at org.junit.platform.engine.support .hierarchical.Node.around( Node.java:137 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.lambda$executeRecursively$9( NodeTestTask.java:139 ) at org.junit.platform.engine.support .hierarchical.ThrowableCollector.execute( ThrowableCollector.java:73 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.executeRecursively( NodeTestTask.java:138 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.execute( NodeTestTask.java:95 ) at java.base/java.util.ArrayList.forEach( ArrayList.java:1541 ) at org.junit.platform.engine.support .hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll( SameThreadHierarchicalTestExecutorService.java:41 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.lambda$executeRecursively$6( NodeTestTask.java:155 ) at org.junit.platform.engine.support .hierarchical.ThrowableCollector.execute( ThrowableCollector.java:73 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.lambda$executeRecursively$8( NodeTestTask.java:141 ) at org.junit.platform.engine.support .hierarchical.Node.around( Node.java:137 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.lambda$executeRecursively$9( NodeTestTask.java:139 ) at org.junit.platform.engine.support .hierarchical.ThrowableCollector.execute( ThrowableCollector.java:73 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.executeRecursively( NodeTestTask.java:138 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.execute( NodeTestTask.java:95 ) at java.base/java.util.ArrayList.forEach( ArrayList.java:1541 ) at org.junit.platform.engine.support .hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll( SameThreadHierarchicalTestExecutorService.java:41 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.lambda$executeRecursively$6( NodeTestTask.java:155 ) at org.junit.platform.engine.support .hierarchical.ThrowableCollector.execute( ThrowableCollector.java:73 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.lambda$executeRecursively$8( NodeTestTask.java:141 ) at org.junit.platform.engine.support .hierarchical.Node.around( Node.java:137 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.lambda$executeRecursively$9( NodeTestTask.java:139 ) at org.junit.platform.engine.support .hierarchical.ThrowableCollector.execute( ThrowableCollector.java:73 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.executeRecursively( NodeTestTask.java:138 ) at org.junit.platform.engine.support .hierarchical.NodeTestTask.execute( NodeTestTask.java:95 ) at org.junit.platform.engine.support .hierarchical.SameThreadHierarchicalTestExecutorService.submit( SameThreadHierarchicalTestExecutorService.java:35 ) at org.junit.platform.engine.support .hierarchical.HierarchicalTestExecutor.execute( HierarchicalTestExecutor.java:57 ) at org.junit.platform.engine.support .hierarchical.HierarchicalTestEngine.execute( HierarchicalTestEngine.java:54 ) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute( EngineExecutionOrchestrator.java:107 ) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute( EngineExecutionOrchestrator.java:88 ) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0( EngineExecutionOrchestrator.java:54 ) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams( EngineExecutionOrchestrator.java:67 ) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute( EngineExecutionOrchestrator.java:52 ) at org.junit.platform.launcher.core.DefaultLauncher.execute( DefaultLauncher.java:114 ) at org.junit.platform.launcher.core.DefaultLauncher.execute( DefaultLauncher.java:86 ) at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute( DefaultLauncherSession.java:86 ) at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute( SessionPerRequestLauncher.java:53 ) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs( JUnit5IdeaTestRunner.java:57 ) 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 ) 2023-06-26 17:02:54.428 INFO 16528 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2023-06-26 17:02:54.430 INFO 16528 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2023-06-26 17:02:54.443 INFO 16528 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. Process finished with exit code -1 </code> [질문 내용] QType 활용 2:22초에서 강사님처럼 리팩토링 후 코드 실행시 NullPointer Exception이 발생합니다. 구글 파일 링크입니다. https://drive.google.com/drive/folders/1FxQskkAngeLJcGPtmKUoj-XCmnxm0MVa?usp=sharing

  • java
  • jpa
댓글 1 좋아요 0 조회수 670

p6spy 1.9.0 -> 1.8.1 버전 관련 내용 공유

해결됨

실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발

p6spy releases를 확인해보면 1.9.0부터 Spring boot 3을 지원한다고 되어있고 테스트시 로그가 안뜹니다. 다른 질문에서보니 해당 버전이 메이븐에서만 지원되어서 그런 듯 합니다. 그래서 바로 아래 버전인 1.8.1을 사용해서 정상적으로 로그가 뜨는 것을 확인했습니다. 그래서 앞으로 최신 버전으로 했을때 안뜬다면 버전을 내려보시면 좋을 것 같습니다.

  • java
  • spring
  • 웹앱
  • spring-boot
  • jpa
김주영 댓글 1 좋아요 3 조회수 829

mapper 이용을 할 때 500 에러가 나고 있습니다.

미해결

스프링 프레임워크는 내 손에 [스프1탄]

controller 단에서 호출하는 mapper 가 오류가 나고 있습니다... 화면에서 crud 시킬때 500에러: Request processing failed; nested exception is java.lang.ClassCastException: java.lang.String cannot be cast to kr.board.entity.MemberUser 근본이유: java.lang.ClassCastException: java.lang.String cannot be cast to kr.board.entity.MemberUser kr.board.controller.MemeberController.memRegister( MemeberController.java:118 ). controller에서 syso 찍어가며 넘어가야할 값들이 다 들어있는것을 확인했습니다. 그런데도 매퍼 접근하려고하면 오류가 나고 있습니다. 콘솔에서의 오류: Exception in thread "main" java.lang.NullPointerException at kr.board.controller.BoardRestController.wifiInfoInsert( BoardRestController.java:66 )

  • jsp
  • spring
  • mvc
  • spring-security
실력자되긔 댓글 1 좋아요 0 조회수 520

deprecate된 authorizeRequests와 access인자 관련

미해결

스프링 시큐리티

강의를 따라가다 antMatchers 와 access 관련해서 도움이 되고자 글을 남깁니다. (1) access 스프링 시큐리티에서 authorizeRequests가 deprecate되면서 hasRole('ADMIN') or hasRole('SYS') 에 인자로 문자열만 받을 수 있게 되었습니다. 이로 인해 특정 경로에 대한 인가를 2개 이상의 role에 주고 싶을시 hasAnyRole을 사용해야 합니다. (2) antMatchers deprecate된 authorizeRequests 대신 스프링에서 사용을 권장하는 authorizeHttpRequests를 사용한 사용자별 인가를 설정하는 코드입니다. // 스프링 시큐리티 5.4에 맞춘 강의 예제 http .authorizeHttpRequests(authorizeHttpRequests -> authorizeHttpRequests .requestMatchers("/user").hasRole("USER") .requestMatchers("/admin/pay").hasRole("ADMIN") .requestMatchers("/admin/**").hasAnyRole("ADMIN", "SYS") .anyRequest().authenticated());

  • java
  • spring-boot
  • spring-security
이상민 댓글 1 좋아요 2 조회수 1681

배포 질문있습니다.

미해결

호돌맨의 요절복통 개발쇼 (SpringBoot, Vue.JS, AWS)

안녕하세요. 해당 강의로 배포를 배우고 있습니다. 현재 별개로 진행하는 스프링부트 프로젝트에서 레디스를 도커를 이용해 (docker-compose up) 실행하고, 스프링 프로젝트를 실행하는 형태로 진행하고 있습니다. 이러한 경우는 배포를 어떻게 해야할지를 모르겠습니다. 원격 ec2 서버에도 마찬가지로 docker desktop 및 redis를 설치하여 실행한 뒤, 스프링부트 프로젝트를 실행해야 할까요?

  • vue.js
  • aws
  • spring-boot
  • jpa
  • spring-security
yjw9424 댓글 2 좋아요 2 조회수 630

enum방식이 실무에서 자주 쓰이는 편인가요??

해결됨

호돌맨의 요절복통 개발쇼 (SpringBoot, Vue.JS, AWS)

안녕하세요 호돌맨님 이번 강의 내용중 3번 enum 을 이용한 방식에 대한 궁금증이 생겨서 질문 드립니다. 제가 생각했을때 enum 방식은 제한적이라 실무에서는 자주 쓰이지 않을 것 같다는 의문이 생겼습니다. 제한적이라고 생각했던 부분은 reflection을 이용한 인스턴스 생성이므로 스프링이 제공해주는 AOP프록시나 DI의 혜택을 받을 수 없다. 입니다. 예시로 들어주신 AnimalSerivce의 구현 클래스들은 트랜잭션이나 기타 AOP기능을 하용하지 않고, 주입받아야 하는 의존성도 없어서 괜찮지만 만약 Controller -> Service 를 호출하는 동일한 구조로 호출 대상이 되는 Service가 AOP프록시나 DI등의 처리가 필요한 클래스라면 AOP미적용, 또는 newInstance() 호출 시 예외 발생등의 문제가 발생할 것으로 보입니다. 실제로 실무에서 변수값에 따라 서로 다른 클래스 컴포넌트를 호출해야하는 상황에서 enum 방식이 자주 쓰이나요??

  • vue.js
  • aws
  • spring-boot
  • jpa
  • spring-security
멀머 댓글 2 좋아요 1 조회수 846

인기 태그

인프런 TOP Writers

주간 인기글