본문 바로가기

코드 정리49

깃헙 스택 아이콘 깃헙 스택 아이콘 링크 https://simpleicons.org/ Simple Icons 2441 Free SVG icons for popular brands simpleicons.org ![image](https://img.shields.io/badge/이름-#제외코드?style=for-the-badge&logo=로고이름&logoColor=white) 2023. 3. 24.
코드 - JPA entitiy 에 리스트 타입 추가하기 코드 - JPA entitiy 에 리스트 타입추가하기 1. converter 클래스 생성 package com.example.dividend.config; import javax.persistence.AttributeConverter; import javax.persistence.Converter; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @Converter public class IntegerArrayConverter implements AttributeConverter { private static final String SPLIT_CHAR = ","; @Override public Strin.. 2023. 3. 22.
비밀키 생성 - base64로 인코딩 비밀키 생성 - base64로 인코딩 jwt 의 비밀키를 생성하기 위해 base64로 인코딩 echo '원하는 문자열' | base64 2023. 3. 22.
Redis Server - 시작 및 종료 1. homebrew 에서 redis 설치 brew install redis 2. redis server 실행 redis-server // (터미널 창 종료 시 종료) brew services start redis // 백그라운드에서 동작 (터미널 창 종료 시 계속 실행) 3. redis server 종료 ctrl + c // foreground 종료 brew services stop redis // 백그라운드 종료 4. 서버 안에서 동작 redis-cli 5. 값 입력 set key value 6. 값 가져오기 get key 7. 값 삭제 del key 8. 모든 키 값 얻기 - 실제 서버 운영시 동작시키면 서버의 성능에 문제가 생길 수 있음 keys * 9. redis 상태 확인 brew servic.. 2023. 3. 21.
Spring Boot - table 'project.diary' doesn't exist 오류 Spring Boot - table 'project.diary' doesn't exist 오류 domain 패키지에 Diary 클래스(entity)를 생성 후 repository를 통해 save를 하는 도중 table 'project.diary' doesn't exist 오류가 발생했다. entity를 생성하였는데 왜 오류가 났을까? 시도 1(실패) @Entity(name="diary") 엔티티에 네임 설정하기 시도 2(실패) private 뒤에 final을 추가하였다. private final DiaryRepository diaryRepository; 시도3(성공) application.properties 파일에 아래 코드 추가 spring.jpa.generate-ddl=true 참고 https://s.. 2023. 3. 16.
오류 - 스프링 mysql 연동시 com.mysql.cj.jdbc.driver 에러(빨간줄) 오류 - 스프링 mysql 연동시 com.mysql.cj.jdbc.driver 에러(빨간줄) Gradle 사용 build.gradle 파일에 implementation 'mysql:mysql-connector-java:8.0.26' 대신 implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.26' 입력 참고 https://stackoverflow.com/questions/33123985/cannot-load-driver-class-com-mysql-jdbc-driver-spring/64735750#64735750 2023. 3. 15.
터미널 - 특정 포트를 사용하는 프로세서 찾기, 좀비 프로세서 죽이기(mac) 터미널 - 특정 포트를 사용하는 프로세서 찾기, 좀비 프로세서 죽이기(mac) 포트 번호로 프로세스 찾기 - lsof -i tcp:포트 번호 lsof -i tcp:3306 프로세스 죽이기 kill -9 72019 계속 살아날 경우(좀비 프로세서) - 부모 프로세서를 찾아서 죽이기 - ps -ef | grep 포트번호 | grep -v grep ps -ef | grep 72019 | grep -v grep 부모 프로세서 죽이기 kill -9 34882 2023. 3. 15.
스프링 - org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported 오류 스프링 - org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported 오류 PostMapping을 실습 중 @Slf4j @RestController public class SampleController { // @RequestMapping(value = "/order/1", method = RequestMethod.GET) @GetMapping("/order/1") public String getOrder(){ log.info("Get some Order"); return "orderId : 1, orderAmount : 1000"; } @PostMapping("/order") publ.. 2023. 3. 6.
인테리제이 단축키 (mac) 인테리제이 단축키 (mac) 1. 테스트 생성 command + shift + t 2. Generate command + n 3. 변수 생성 option + command + v 4. 해당 위치 삭제 command + d 5. 라인 정리 option + command + l 6. import 정리 control + option + o 7. 해당 클래스로 이동 command + 클릭 8. 실행 control + shift + r 9. 클래스 선언부, 사용부 보기 ctrl + command + 클릭 10. 검색 창 shift + shift 11. 최근 파일 보기 command + E 참고 https://mangkyu.tistory.com/139 2023. 3. 5.