본문 바로가기

전체 글174

java.lang.IllegalAccessException: Class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor can not access a member of class org.example.entity.BaseEntity with modifiers "public" 모든 Entity는 BaseEntity를 상속한다. import java.time.LocalDateTime; import javax.persistence.Column; import javax.persistence.EntityListeners; import javax.persistence.MappedSuperclass; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import lombok.Getter; @Gett.. 2021. 5. 9.
[security] 정리 [코드로 배우는 스프링부트] - 구멍가게 코딩단 1. id/pw로 로그인 1. security lib 추가 2. config 추가 @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { 3. passwordEncoder 추가 @Bean PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } 4-1. 직접 [인증] 매니저 설정 @Override ptected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .wit.. 2021. 5. 6.
[security] getPassword() is null [코드로 배우는 스프링부트] - 구멍가게 코딩단 기준 plugins { id 'org.springframework.boot' version '2.4.4' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'com.adarshr.test-logger' version '2.1.1' id 'java' id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10' } ClubLoginSuccesshandler로 로그인 성공후 AuthenticationSuccessHandler에서 redirect하는 부분. ClubAuthMemberDTO authMember = (ClubAuthMemberDTO) authent.. 2021. 5. 6.
github actions Treating warnings as errors because process.env.CI = true Most CI servers set it automatically. github actions에서 git push 하면, 자동 빌드 및 S3 배포를 설정하는 중에 build 에러 warning이 하나라도 있으면 error로 간주해서 build가 실패한다.ㅠ 보통 lint warning... 뭐 CI = npm run build... ? 이렇게 하라지만... warning도 고치자. lint 반영하기 싫으면 rules에서 off~ ============ 스크립트 작성시 주의 (main / stage) 1. name은 꼭 다르게 하자. 안그럼 이렇게 나온다.ㅠ 2. secrets는 프로젝트 settings.. 2021. 4. 27.
[Spring data JPA] 조회: Entity + 연관 Entity(LAZY) + Pageable 기준: springboot 2.4.4 1:N (Team: Member) *주의!! @EntityGraph가 뭔가 새로운 것인줄 알았는데, 결국 내부 로직은 fetch이다. 엔티티, 연관엔티티 모두 한번에 조회를 하고 싶고, Page기능까지 추가하고 싶다. (뷰를 위한 rest api에서는 page기능은 필수이다. 그리고 대부분 엔티티 단위로 조회를 할 것이다.) 시도1. inner join fetch + Pageable 에러.. query specified join fetching, but the owner of the fetched association was not present in the select list................ 안되는줄 알았지만 그냥 해봤다... 시도2. @EntityG.. 2021. 4. 24.
[Spring data JPA] native query + XML + DTO 기준: springboot 2.1.9 JPA를 사용하는 이유가 객체지향적인 설계와 개발 생산성을 위함인데, 왜 String을 여러라인으로 붙여 쓰고 있지? + + + + + + 왜 SQL 결과를 Object[]로 받는 방법을 사용하는지 이해가 안된다. (다시 10년전 과거로 돌아간 기분이다...) ResultMapping을 어노테이션으로 잡다하게 설정하는게 과연 Mybatis에서 JPA로 탈출한 취지에 맞는가? String 여러 라인을 붙여쓰거나 리턴으로 Object[]로 받을거면 그냥 Mybatis 쓰는게 낫겠다. * multiLine String은 XML로... * Object[]은 Dto로 해결... native query + XML + DTO org.example.api.dto.NativeDto1.. 2021. 4. 24.
JPA 씹어먹기 기준: springboot 2.1.9 "자바 ORM 표준 JPA 프로그래밍", 김영한님의 책은 놀랍다. 1번 읽고 느낀점: JPA에 무작정 뛰어들면 안되는구나. 개념없이 맨땅에 헤딩하면, 많은 시간을 낭비할 것 같다.(한번 시도했다가 수많은 에러만 만났다.) JPA는 정석대로 배우는게 좋겠다. 한번 읽고, 다 정리가 안되어서, 두번 읽고, 실습하고, 나름대로 정리를 해본다. 초판은 2015년. 현재는 2021년. 꽤 많은 세월이 흘렀음에도 대적할만한 책이 없다. 책을 읽으면서 주의할 점은 Spring Data JPA가 지원하는 기능 JPA가 지원하는 기능 하이버네이트가 지원하는 기능이 조금씩 다르다. 이 부분을 비교해가면서 읽어야 나중에 혼란이 없다. * 영속성 컨텍스트(1차 캐시)는 1회성이다. 트랜잭.. 2021. 4. 19.
s3-spa-upload windows 이슈 윈도우 PC에서 실행시키면, 파일 path에 백슬래시가 존재한다. 실제 업로드된 파일을 확인해 보면, 폴더 구조가 생성되지 않고, 백슬래시가 포함된 파일명으로 생성이 된다. Uploaded s3://버킷/\static\css\main.942763e1.chunk.css |........... 해결 option으로 처리가 안되어서.... node_modules의 소스코드를 바꾼다. s3-spa-upload/src/index.js uploadToS3 함수에서 key 값이 "\aa\aa\aaa\aa.js"처럼 들어옴. 변경전 Key: "" + prefix + key, 변경후 Key: "" + prefix + key.substring(1).replace(/\\/g, '/'), (나중에 버전업 되면 개선되겠지...) 2021. 4. 13.