전체 글 95

Kotlin Springboot Rest API 만들기 1 - 프로젝트 생성

전체 코드 https://github.com/GHGHGHKO/pepega-blog-kotlin 모든 IDE를 사용해도 좋습니다. 글에서는 Intellij를 활용합니다. IDE : Intellij IDEA OS : Windows 10 1. 프로젝트 생성 https://start.spring.io/ 위 링크에서 프로젝트를 생성합니다. JPA를 활용하기 위한 Spring Data JPA 무분별한 API 호출을 방지하기 위한 Spring Security 요청(Request body) 유효성 체크를 위한 Validation RESTful API를 생성하기 위한 Spring Web 로컬 테스트를 위한 H2 Database 개발 환경 구축을 위한 PostgreSQL(다른 DB도 상관 없습니다.) 코드를 Github에..

Kotlin 2023.01.02

RequestParam(required = true) null exception 하는 법

전체 코드 https://github.com/GHGHGHKO/goose-auth-api-server GitHub - GHGHGHKO/goose-auth-api-server Contribute to GHGHGHKO/goose-auth-api-server development by creating an account on GitHub. github.com @Operation(summary = "GooseAuth delete item uris", description = "id로 접속 정보의 uri들을 삭제한다.") @DeleteMapping(value = "/items/{itemIdentity}") public ResponseEntity gooseAuthDeleteItemUris( @Parameter(nam..

SpringBoot 2022.10.05

jib 배포, 코드 배포, 코드 컨테이너, 앱 컨테이너 만들기

https://alden-kang.tistory.com/1 jib를 이용한 자바 앱 컨테이너화 오늘은 구글 클라우드 도구 중 하나인 jib를 이용한 자바 애플리케이션 컨테이너화 과정에 대해 살펴보려고 합니다. jib가 무엇인지 궁금하신 분들을 위해 간단한 설명과 예제 애플리케이션을 alden-kang.tistory.com 해당 출처를 기반으로 만들었습니다. 본 블로그에서는 java 11을 활용했습니다. jib은 해당 명령어를 실행하면 설정되어 있는 컨테이너 장소에 이미지를 push 하는 명령어이다. 자세한 내용은 출처에 있다. 바로 시작 build.gradle에 아래와 같이 설정한다. plugins { id 'org.springframework.boot' version '2.7.1' id 'io.spri..

SpringBoot 2022.07.15

Docker로 프로젝트(Springboot), DB(Postgres), 캐시(Redis) 연동하기

취미생활로 프로젝트를 하나 시작했다. 아직 github에 push 하진 않았지만 시작 중 방법을 올려보려고 한다. # Use postgres/example user/password credentials version: '3' services: goose-auth-api: image: gudrb963/goose-auth-api:latest container_name: goose-auth-api build: context: . ports: - 8080:8080 depends_on: - postgres environment: - SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/gooseauth - SPRING_DATASOURCE_USERNAME=gooseauth..

Docker 2022.07.15

Airflow query csv export, 쿼리로 csv export

공식문서를 기반으로 만들었다. https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/hooks/dbapi/index.html#airflow.hooks.dbapi.DbApiHook.get_pandas_df 아래 내용을 토대로 만들었다. https://pepega.tistory.com/49 전체 코드는 아래에 있다. https://github.com/GHGHGHKO/airflow/commit/7509b3c13816629c450afc8f8a325143c1da1d65 기존에는 get_records 메서드를 활용했다. def execute(self, context): hook = PostgresHook( postgres_conn_id = self...

Airflow 2022.03.20

Airflow XComs Email 전송

Airflow로 Email 전송하는 글을 포스팅했었다. https://pepega.tistory.com/47 블로그 코드는 https://github.com/GHGHGHKO/airflow/blob/master/dags/email_xcom_test.py 전 포스팅 내용을 기반으로 DAG을 만들었다. email_operator = EmailOperator( task_id='send_email', to='receiver@example.com', subject='[TEST] 테스트 메일입니다.', html_content=""" 테스트 메일입니다. ninja template {{ data_interval_start }} {{ ds }} {{ task_instance.xcom_pull(dag_id='postgres..

Airflow 2022.03.18

Airflow OracleOperator Custom 하기

공식 문서를 기반으로 작성하였다. PostgresHook https://airflow.apache.org/docs/apache-airflow-providers-oracle/stable/_modules/airflow/providers/oracle/hooks/oracle.html#OracleHook DbApi https://airflow.apache.org/docs/apache-airflow/stable/_modules/airflow/hooks/dbapi.html#DbApiHook.get_first 하단 코드는 아래에 있다. https://github.com/GHGHGHKO/airflow/commit/47de1fd55ff2be812702ba4539adf54e6d9bd292 OracleOperator 사용 할..

Airflow 2022.03.17

Airflow PostgresOperator Custom 하기

공식 문서를 기반으로 작성하였다. PostgresHook https://airflow.apache.org/docs/apache-airflow-providers-postgres/stable/_api/airflow/providers/postgres/hooks/postgres/index.html#airflow.providers.postgres.hooks.postgres.PostgresHook.conn_name_attr DbApi https://airflow.apache.org/docs/apache-airflow/stable/_modules/airflow/hooks/dbapi.html#DbApiHook.get_first 하단 코드는 아래에 있다. https://github.com/GHGHGHKO/airflow/..

Airflow 2022.03.17

Airflow custom Operator 만들기

공식 문서를 기반으로 글과 코드를 작성하였다. https://airflow.apache.org/docs/apache-airflow/stable/howto/custom-operator.html 코드는 아래에 있다. https://github.com/GHGHGHKO/airflow/commit/37966fd4e8774e04c95f6393fd796b86573d4dc2 예시를 들어서 내용을 적도록 하겠다. 테이블 스페이스가 부족할 때 경고 메일을 보내는 스케줄을 추가하려고 한다. 메일 내용에 특정 테이블 스페이스 이름을 넣은 채로 메일을 보내고 싶은데 --테이블 스페이스 이름 조회 select name from table_space; Airflow에서 제공하는 SQLOperator는 Airflow의 XCOM으로 ..

Airflow 2022.03.16