전체 글
-
NumberFormatException운영 중인 서비스/Coconut. 2024. 1. 23. 15:30
게시글 조회하기 api 작성하면서 테스트 케이스를 적던 중에 만난 이슈입니다. 결론은 NumberFormatException 은 IllegalArgumentException을 상속하고 있다. 입니다 ㅎㅎ 게시글 상세를 가져오는 서비스 코드 입니다. 만약 id가 숫자로 변환이 불가능한 문자열이 들어오는 케이스를 대응하려고 하고 있었습니다. @Override public PostResDto getPost(String id) { int postId = Integer.parseInt(id); PostResDto dto = new PostResDto(1, "t","t","t","2",1, LocalDateTime.now()); return dto; } 500이 응답으로 올걸 예상하고 포스트맨으로 id에 a를 넣어..
-
Spring boot 2.7.18에서 swagger 설정하기 <2>프레임워크/Spring Boot 2024. 1. 23. 02:21
프로젝트를 함께 만들고 있는 프론트엔드 개발자들과 효율적인 커뮤니케이션을 위해서 스웨거를 사용하려고 합니다. 적용하면 만난 이런 저런 이슈 사항들을 기록해보았습니다. 프로젝트 버전 spring boot: 2.7.18 springdoc-openapi-ui: 1.7.0 1. 프로젝트 코드에 작성 어노테이션을 사용해서 컨트롤러의 메소드와 관련된 dto들에 명세를 추가해주면 web에서 확인이 가능합니다. api 명세 작성 @Operation(summary = "게시글 생성", description = "제목, 내용, 작성자, 카테고리를 포함하는 게시글을 작성합니다.") @ApiResponses(value = { @ApiResponse(responseCode = "201", description = "게시물 생성..
-
Spring boot 2.7.18에서 swagger 설정하기 <1>프레임워크/Spring Boot 2024. 1. 22. 19:45
프로젝트를 함께 만들고 있는 프론트엔드 개발자들과 효율적인 커뮤니케이션을 위해서 스웨거를 사용하려고 합니다. 적용하면 만난 이런 저런 이슈 사항들을 기록해보았습니다. 프로젝트 버전 spring boot: 2.7.18 springfox: 3.0.0 springdoc-openapi-ui: 1.7.0 요즘은 gpt에게 물어봐서 대략적인 흐름을 파악하고, 한 단계씩 검증하며 적용하는 방법으로 작업을 하는 것 같습니다. 아래 처럼 3단계면 된다고 하는데, 당연히 한번에 안될것이라 예상하고 가보겠습니다. 1. SpringFox 사용 Step1. 의존성 추가하기 아래의 의존성을 추가하기 전에 공식 홈페이지를 한번 찾아가봅니다. implementation 'io.springfox:springfox-boot-starte..
-
홈 서버 구축기 <2>OFF THE RECORD/홈서버 2024. 1. 14. 18:18
지금까지는 aws에서 free tier로 제공하는 ec2를 사용했었는데, 이번에 백엔드 과정하면서 ec2 하나로 부족함이 느껴져서 개인 서버를 하나 둬야되겠다고 마음을 먹었습니다. 기계에 별로 관심도 없고, 게임에도 크게 관심이 없어서 살면서 컴퓨터 부품을 알아본 적이 한번도 없었기에 굉장히 막막했었는데, 그래도 얼마전에 부품 구매부터 조립, OS 설치까지 제 손으로 다 끝내고 개인 서버를 사용하고 있으니 뿌듯하기 그지없습니다 ㅎㅎ 시간이 더 지나기 전에 서버 컴퓨터 만든 과정을 기록으로 남겨봅니다. 1. 인터넷 배선 확인 2. 부품 구매 및 조립 3. OS 설치 및 사용 이전 글인 홈서버 구축 에서 계속 되는 글입니다. 2. 부품 구매 및 조립 이번에 만드는 컴퓨터의 주요 목적은 서버환경 구축 연습이 ..
-
홈 서버 구축기 <1>OFF THE RECORD/홈서버 2024. 1. 14. 16:50
지금까지는 aws에서 free tier로 제공하는 ec2를 사용했었는데, 이번에 백엔드 과정하면서 ec2 하나로 부족함이 느껴져서 개인 서버를 하나 둬야되겠다고 마음을 먹었습니다. 기계에 별로 관심도 없고, 게임에도 크게 관심이 없어서 살면서 컴퓨터 부품을 알아본 적이 한번도 없었기에 굉장히 막막했었는데, 그래도 얼마전에 부품 구매부터 조립, OS 설치까지 제 손으로 다 끝내고 개인 서버를 사용하고 있으니 뿌듯하기 그지없습니다 ㅎㅎ 시간이 더 지나기 전에 서버 컴퓨터 만든 과정을 기록으로 남겨봅니다. 1. 인터넷 배선 확인 2. 부품 구매 및 조립 3. OS 설치 및 사용 1. 인터넷 배선 확인 만났던 첫번째 이슈는 랜선 사용이었습니다. 거실 벽에 있는 랜선 포트에서 선을 가져다가 공유기에 연결해서 WI..
-
Docker와 Jenkins를 사용하여 CI/CD 구축 <2>인프라/젠킨스 2024. 1. 13. 20:26
학습 내용 젠킨스 사용을 위해서 이런 저런 책과 유뷰브 영상을 찾아보고 직접 적용을 해보겠습니다. 깃에 push가 발생하면 젠킨스가 작동해서 도커 hub에 새로운 이미지를 업로드합니다. 또 작업내용을 slack에서 메세지로 받아봅니다. step1: 웹서버 및 젠킨스 서버 배포 step2: 깃 코드 변경 > 새로운 이미지 빌드 > 도커 허브 갱신 > 신규 이미지로 서버 재배포 이전 글에서 이어지는 내용입니다. 6. Github 연결 첫 진입시 모달에서 파이프라인 생성 버튼을 눌러줍니다. 깃헙 레포와 연결해서 사용할 것이기 때문에 github 선택해주고, token을 생성해서 넣어줍니다. "Create an access token here" 누르면 필요한 권한이 세팅된 화면을 볼 수 있습니다. 이후에 연결..
-
컨테이너에서 Docker 명령어 사용하기인프라/도커 2024. 1. 13. 03:36
도커 컨테이너에서 젠킨스를 실행하고, build를 진행하는 과정에서 발생한 이슈를 해결해봅니다. 도커 컨테이너에서 docker 명령어를 실행하려면 어떻게 해야할까요 도커를 사용해서 띄운 컨테이너지만, 격리된 공간이기 때문에 컨테이너 내부에는 별도로 도커를 설치하지 않는 이상 도커의 존재를 모르는 상태입니다. 그렇다면 그냥 도커를 설치하면 되는 것 일까요? gpt에게 물어보니 몇 가지 방법이 있다고 합니다. Docker-in-Docker Docker 외부실행 Docker 소켓마운트 저는 소켓마운트 방법을 사용해서 문제를 해결해보도록 하겠습니다. 제가 사용하고 있는 젠킨스에 호스트의 Docker 소켓을 연결하고 컨테이너 속에서 도커 클라이언트를 설치해서 사용하겠습니다. 1. Docker 소켓 마운트 도커 컨..
-
List 정렬에 대하여언어/자바 2024. 1. 12. 01:06
List를 정렬하는 여러가지 방법들을 정리해본다. Collections.sort 에서부터 stream.sorted까지 살펴본다. 글의 흐름은 Head First Java를 기초로 하고 있다. 정렬하는 방법들 1. Collections.sort(List) List인 경우만 정렬이 가능하다. /* 배열은 정렬 불가 */ String[] sArr = {"z", "b", "k"}; Collections.sort(sArr); // error /* List로 변경해서 정렬 */ String[] sArr = {"z", "b", "k"}; List sList = Arrays.asList(sArr); System.out.println("b4" + sList); // z,b,k Collections.sort(sList);..