Health-Genie
-
[error] No enum constant enum명.값 해결방법Health-Genie 2023. 11. 21. 09:59
처음에 엔티티 설정시, 필드 설정을 이런식으로 하고 @Column(name = "status") private Status status; enum class를 @Getter public enum Status { YET, // "아직 끝나지 않은 to-do" DONE // "끝난 to-do" } 이런식으로 설정을 해주었고, 데이터를 삭제할때 위와 같은 에러를 만났다. 이유는 데이터 삽입시 entity class에 있는 status 필드에 @Enumerated(EnumType.STRING) 위와 같은 애노테이션을 넣지 않았기에, DB에는 status가 숫자값으로 저장되지만, 삭제할때는 enum 값을 받아오면서 생기는 충돌로 발생한것이다. 해당 애노테이션을 붙여줌으로써 DB에 존재하나 enum에 없는 값을 e..
-
[error] Could not write JSON: Infinite recursion (stackOverflowError)Health-Genie 2023. 11. 19. 19:59
ptProcess 에서 list 조회를 하는데 발생했던 에러입니다. 에러에 해당했던 부분은 service 파일 안에 코드입니다 @Transactional(readOnly = true) public Page getAllTrainerProcess(Long trainerId, int page, int size){ return ptProcessRepository.findAllByTrainerId(trainerId, PageRequest.of(page, size)); } 에러를 고친 후의 코드입니다 @Transactional(readOnly = true) public Page getAllTrainerProcess(Long trainerId, int page, int size){ Page process = ptPr..
-
[이메일 인증] 이메일 인증 구현 & 코드 검증!Health-Genie 2023. 11. 18. 14:55
배경 해당 프로젝트에서 이메일 인증 기능이 필요해졌다! 그래서 나는 Google SMTP 서버를 이용해서 이메일 인증을 진행하도록 했다. 개발 환경 Java 17 Spring 3.x Gradle MySQL IntelliJ 흐름 사용자는 이메일을 입력 후 이메일 인증 버튼 클릭 클라이언트 서버에게 사용자의 이메일로 인증 번호 전송 요청 서버는 랜덤 인증 번호 생성. 인증 번호를 auth code table에 저장 후 사용자의 이메일로 인증 번호 전송 사용자는 인증 번호 확인 후 인증 번호 입력 후 확인 버튼 클릭 클라이언트는 서버에게 인증 번호 검증 요청 서버는 전달받은 인증 번호가 auth code table에 저장된 인증 번호와 동일한지 확인 후 동일하면 true 반환 SMTP에서 사용할 구글계정을 등..
-
[symbol 에러] error: cannot find symbol log.infoHealth-Genie 2023. 6. 12. 22:57
내가 겪은 문제입니다 error: cannot find symbol log.info 해결 방법 1. lombok dependency 잘 쓰기 implementation 'org.projectlombok:lombok' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' 2. 다른 test annotation을 gradle 추가해주기 testAnnotationProcessor 'org.projectlombok:lombok' //추가 참고로 다 작성하면 코끼리 눌러서 build 시켜주기
-
[UserDetail] InternalAuthenticationServiceException 에러Health-Genie 2023. 6. 4. 16:18
내가 겪은 에러 InternalAuthenticationServiceException: class com.example.healthgenie.entity.User cannot be cast to class org.springframework.security.core.userdetails.UserDetails 이 에러는 Entity안에 User라는 파일에서 UserDetails를 implement하지 않아서 생기는 문제이다. 그럼으로써, UserDetails형식으로 반환되야 하는 loadUserByUsername 메소드가 {}이 return되는 문제가 생긴다 내가 해결한 방법은 public class User extends BaseEntity implements UserDetails { @Override ..
-
[mail] Authentication Fail 문제Health-Genie 2023. 6. 4. 13:39
내가 겪은 에러 mail.MailAuthenticationException: Authentication failed yml 파일에 들어있는 mail 부분에 username이랑 password가 잘못들어 있다는 의미이다. 1. jasyptStringEncryptor을 사용하는 경우 [구성 편집]을 잘 작성했는지, 혹은 아래를 잘 작성했는지 확인하기 https://www.devglan.com/online-tools/jasypt-online-encryption-decryption Programming Blog Article Feeds as per your Interest | DevGlan Best programming article feeds as per your Interest on different tec..
-
[MySQL 1822 에러] Failed to add the foreign key constraintHealth-Genie 2023. 6. 2. 21:42
Failed to add the foreign key constraint 이 에러는 Foreign key 제약조건을 만족하지 않았을 때 발생하는 에러입니다. 또한 java spring boot를 실행했을때 실행이 되지 않는건 아닌데, 실행 창에 경고식으로 나타난다. Caused by: java.sql.SQLException: Failed to add the foreign key constraint. Missing column 'user_id' for constraint '**' in the referenced table 'user_tb' https://stackoverflow.com/questions/43511183/mysql-error-1822-failed-to-add-foreign-key-constr..
-
[DB설계] ERD 설계Health-Genie 2023. 5. 24. 21:08
논리적 & 물리적 설계 차이 참고로, erd테이블도 [왼쪽이 논리적 설계, 오른쪽이 물리적 설계] 이며, erd field도 논리필드, 물리필드 순서이다. 간단한 정리 논리적 설계 -> 사용자 관점에서 본 데이터의 논리적 배치 물리적 설계 -> 저장하는 관점에서 본 데이터의 물리적 배치로 데이터의 실체 구조 말하고자 하는바 @Table(name="USER_TB") -> DB에 실제로 저장되는 테이블 이름 [ 물리적 설계 ] public class User {} -> 사용자가 보는 테이블 이름 [ 논리적 설계 ] @Column(name="uniname) -> DB에 실제로 저장되는 field 이름 [ 물리적 설계 ] private String uniName; -> 사용자가 보는 field 이름 [ 논리적 ..