You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AuthController, UserController생성 - 인증, 유저 각각에 관한 사용자의 요청 처리
컨트롤러의 각 메소드를 목적에 맞게 권한을 가진 유저만 호출가능하게 변경
LoginRequest, UserRequest 생성
TokenResponse, UserResponse 생성
Authority, User Entity 생성
Product Entity에 register필드 추가
Exception 폴더 생성 Jwt사용에 있어 발생하는 예외를 처리해주는 클래스를 담은 폴더
Jwt폴더 생성
- TokenProvider: 토큰을 생성하는 역할
- JwtFilter: FilterChain내에서 JwtFilter에서 동작하는 방식을 정의
- JwtSecurityCofig: JwtSecurity에 관한 환경설정 클래스(ex: SecurityFilterChain에서 어느 자리에 JwtFilter를 끼워넣을지)
SecurityUtil 생성 authentication에서 유저이름을 받아오는 유틸성 클래스
##어려웠던 점##
어제까지 잘 돌아가던 코드가 다음 날 엄청나게 많은 오류를 맞이했습니다.
Public Key Retrieval is not allowed
Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
Exception during pool initialization.
Could not obtain connection to query metadata
-해결 방법-
구글링 해본결과 에러가 발생하는 원인은 useSSL=false로 설정하고 allowPublicKeyRetrieval설정을 하지 않은 경우라고 합니다.
솔직히 너무 처음보는 내용이고 어려운 부분이 많아서 코드를 짜면서 아직 이해가 미흡한 상태로 짠 부분도 많다고 느꼈습니다. Token사용에있어 전체적인 구조에 관한 부분을 리뷰받고싶습니다
위에 어려웠던 점에서 해결하지못한 왜 useSSL설정과 allowPublicKeyRetrieval설정을 해야 오류가 사라지는지에 대해 궁금합니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Week4(Reservation(JPA))
Controller
Dto
Entity
테이블에 존재하는 칼럼들을 필드로 가지고있는 객체
Repository
Etity에 있는 데이터를 조회하거나 저장과 변경 그리고 삭제를 할때 Spring JPA에서 제공하는 Repository라는 인터페이스를 정의해 해당 Entity와 매핑된 데이터베이스를 처리하는 역할
Service
사용자의 요청에 맞도록 정보를 가공하는 역할
새롭게 공부한 것
-예외처리(GlobalCatcher)-
메서드 단위 처리 try catch - 코드가 복잡해지고 유지보수가 어려움
Controller단에서 처리 @ExceptionHandler - 다른 Controller에서 사용할수 없음 범용성이 낮다
전역 처리 @ControllerAdvice사용 - 모든 Controller에서 발생한 예외를 처리할 수 있다
@transactional
@entity
@id
@GeneratedValue
@onetomany
@manytoone
어려웠던 점
코드리뷰 받고싶은 점
예외처리를 함에 있어서 전역처리보다 컨트롤러단이나 매서드 단위로 처리하는 경우의 장점이 있는지 궁금합니다.
예외처리를 처음해봐서 보통 API에서 예외를 어떻게 처리하는지를 몰라 예외처리 부분을 리뷰받고 싶습니다.
같은 Entity 안에서 다른 데이터를 각각 원할때 @query어노테이션을 통해서 쿼리문을 작성해서 원하는 데이터만 조회가 가능한지 궁금합니다.
dto.response에 각기 다른 응답들을 위해 각기 다른 클래스를 만들다보니 많은 클래스가 만들어졌는데 공통된 필드를 가진 클래스가 많아서 이것을 줄이고 싶은데 줄일 방법이 있는지 궁금합니다.