=================
== The Archive ==
=================

[Spring AI] 프로젝트 만들기

|

Introduction

프로젝트 생성하기

0.png

1.png

추가 설정

JDK 버전 설정

Kotlin 버전 설정

Gradle 버전 설정

Spring AI bom 버전 설정

Ktlint 설정

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
plugins {
    kotlin("jvm") version "2.0.20"
    kotlin("plugin.spring") version "2.0.20"
    id("org.springframework.boot") version "3.3.4"
    id("io.spring.dependency-management") version "1.1.6"
    kotlin("plugin.jpa") version "2.0.20"
    id("org.jlleitschuh.gradle.ktlint") version "12.1.1"
}

...

ktlint {
    version.set("1.3.1")
}

compose.yml 수정

1
2
3
4
5
6
7
8
9
services:
  postgres:
    image: 'postgres:latest'
    environment:
      - 'POSTGRES_DB=mydatabase'
      - 'POSTGRES_PASSWORD=secret'
      - 'POSTGRES_USER=myuser'
    ports:
      - '5432'
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
services:
  postgres:
    container_name: 'kotlin-spring-ai-postgres'
    image: 'postgres:latest'
    environment:
      - 'POSTGRES_DB=kotlin_spring_ai_database'
      - 'POSTGRES_PASSWORD=postgres'
      - 'POSTGRES_USER=postgres'
    ports:
      - '54324:5432'

application.properties 를 application.yaml 로 수정

application.yaml 에 spring.ai.openai.api-key 추가

1
2
3
4
5
6
spring:
  application:
    name: kotlin-spring-ai-playground
  ai:
    openai:
      api-key: ${OPENAI_API_KEY}

Conclusion

Categories:

Tags: