분류 전체보기
-
[DOCKER] Docker에 MySQL 적용부터 WorkBench 연결까지!Spring Boot 2023. 2. 14. 21:32
https://oingdaddy.tistory.com/299 1. 도커 설치 https://www.docker.com/products/docker-desktop/ 2. MySql 워크벤치 설치 https://dev.mysql.com/downloads/workbench/ 도커에 이미지 생성 docker pull mysql:버전숫자 (현재 플젝 기준 👉 docker pull mysql:8.0.32) 도커에 생성된 이미지 확인 docker images 도커 컨테이너 생성 및 실행 docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=비밀번호 --name 마이에스큐엘서버이름 mysql:버전숫자 --character-set-server=utf8mb4 --collation-ser..
-
[SPRING] 강한결합, 느슨한 결합?Spring Boot 2023. 2. 12. 13:04
스프링데이터 JPA 레포지토리에 메서드를 추가해주다가 에러가 발생했다. User_Id로 조회해올 수가 없는 것이다. 이유가 무엇일까 생각해보았다. User NoticeBoard 테이블의 연관관계는 현재 NoticeBoard쪽에서만 @ManyToOne으로 단방향이다. NoticeBoard는 User 필드를 가지고 있는데, @JoinColumn(name="user_id")를 선언해주면 mapped 어쩌구 에러를 일으켜서 해주지 않았다. 아마도 User 엔티티에서도 @OneToMany를 걸어주었을 때만 쓰는 것 같은데, 이걸 안했으니 그런 것 같다. 근데 Repository에서 findBy---User_Id를 쓰려면 @JoinColumn(name="user_id")를 해줘야 하는 것 같다. 즉, 양방향 연관관..
-
Unable to locate Attribute with the the given name [id] on this ManagedType에러 일기 2023. 2. 12. 12:34
스프링데이터 JPA 레포지토리에 메서드를 추가해주다가 에러가 발생했다. User_Id로 조회해올 수가 없는 것이다. 이유가 무엇일까 생각해보았다. User NoticeBoard 테이블의 연관관계는 현재 NoticeBoard쪽에서만 @ManyToOne으로 단방향이다. NoticeBoard는 User 필드를 가지고 있는데, @JoinColumn(name="user_id")를 선언해주면 mapped 어쩌구 에러를 일으켜서 해주지 않았다. 아마도 User 엔티티에서도 @OneToMany를 걸어주었을 때만 쓰는 것 같은데, 이걸 안했으니 그런 것 같다. 근데 Repository에서 findBy---User_Id를 쓰려면 @JoinColumn(name="user_id")를 해줘야 하는 것 같다. 즉, 양방향 연관관..
-
[SPRING] Redis를 사용해보장Spring Boot 2023. 2. 9. 20:39
캐시를 사용하기 좋은 데이터 1. 변경될 일이 없는 데이터베이스 조회값 2. 자주 호출되는 데이터 스프링부트에서 사용되는 캐시는 대부분 JSR-107을 따름. Redis가 범용적으로 사용됨. Remote Dictionary Server의 약자로, '키-값' 구조의 데이터를 저장하고 관리하기 위한 '오픈 소스' 기반의 비관계형 데이터 관리 시스템. 레디스의 특징 1. 메모리를 사용(인메모리), 데이터베이스와는 다른 방식. 코어에 가깝기 때문에 속도가 빠름. 2. 견고하다. 어떤 데이터가 내 스트럭쳐 안에 들어오면 무조건 데이터의 특징들을 잘 보존해준다. 3. 확장성. 커스텀 익스텐션을 많이 제공하며 API가 많다. 접근성이 용이하다는 뜻. 4. 레디스 서버를 여러개 두고 동기화 처리를 할 수 있다. 5. ..
-
Unnecessary stubbings detected. Clean & maintainable test code requires zero unnecessary code. Following stubbings are unnecessary에러 일기 2023. 2. 9. 16:37
필요없는 When을 지우라는 뜻이다. when을 잘못 썼으니까 필요없어진 것 같다. when 안에서 조회하는 Repository.findAll() 같은 메서드 안에 매개변수를 잘 넣어줬는지 확인한다. Sevice쪽 해당 메서드 들어가서 Repository.findAll()에 매개변수와 다를것이다.