To create a simple REST API server using Spring Boot, you'll need to follow these steps:

1. Set up the project
2. Configure PostgreSQL and JPA
3. Create the Product entity
4. Create the Product repository
5. Create the Product service
6. Create the Product controller

Let's go through each step in detail.

### 1. Set up the project

First, generate a new Spring Boot project from the [Spring Initializr](https://start.spring.io/). Select the following options:

- Project: Maven Project
- Language: Java
- Packaging: Jar
- Java Version: 11 or higher
- Dependencies: Web, JPA, PostgreSQL Driver

After generating the project, import it into your favorite IDE.

### 2. Configure PostgreSQL and JPA

Open `src/main/resources/application.properties` file and add the following configuration for PostgreSQL and JPA:

```
spring.datasource.url=jdbc:postgresql://localhost:5432/mydatabase
spring.datasource.username=myuser
spring.datasource.password=mypassword
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
```

Replace `mydatabase`, `myuser`, and `mypassword` with your actual database name, username, and password.

### 3. Create the Product entity

Create a new package named `com.example.demo.entity` and inside that package, create a new class called `Product.java`. Add the following code:

```java
package com.example.demo.entity;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class Product {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String name;
    private Double price;

    // Getters and setters

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }
}
```

### 4. Create the Product repository

Create a new package named `com.example.demo.repository` and inside that package, create a new interface called `ProductRepository.java`. Add the following code:

```java
package com.example.demo.repository;

import com.example.demo.entity.Product;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface ProductRepository extends JpaRepository<Product, Long> {
}
```

### 5. Create the Product service

Create a new package named `com.example.demo.service` and inside that package, create a new class called `ProductService.java`. Add the following code:

```java
package com.example.demo.service;

import com.example.demo.entity.Product;
import com.example.demo.repository.ProductRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductService {

    @Autowired
    private ProductRepository productRepository;

    public List<Product> getAllProducts() {
        return productRepository.findAll();
    }

    public Product getProductById(Long id) {
        return productRepository.findById(id).orElse(null);
    }

    public Product addProduct(Product product) {
        return productRepository.save(product);
    }

    public Product updateProduct(Product product) {
        return productRepository.save(product);
    }

    public void deleteProduct(Long id) {
        productRepository.deleteById(id);
    }
}
```

### 6. Create the Product controller

Create a new package named `com.example.demo.controller` and inside that package, create a new class called `ProductController.java`. Add the following code:

```java
package com.example.demo.controller;

import com.example.demo.entity.Product;
import com.example.demo.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/products")
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping
    public List<Product> getAllProducts() {
        return productService.getAllProducts();
    }

    @GetMapping("/{id}")
    public Product getProductById(@PathVariable Long id) {
        return productService.getProductById(id);
    }

    @PostMapping
    public Product addProduct(@RequestBody Product product) {
        return productService.addProduct(product);
    }

    @PutMapping
    public Product updateProduct(@RequestBody Product product) {
        return productService.updateProduct(product);
    }

    @DeleteMapping("/{id}")
    public void deleteProduct(@PathVariable Long id) {
        productService.deleteProduct(id);
    }
}
```

Now you have a simple REST API server using Spring Boot with endpoints to add, update, delete, and retrieve records from a "products" table in a PostgreSQL database. Run the application by running the main class generated by Spring Initializr (e.g., `DemoApplication.java`) and test the endpoints using tools like Postman or curl.
Spring Boot를 사용하여 간단한 REST API 서버를 생성하려면 다음 단계를 따라야 합니다.

1. 프로젝트 설정
2. PostgreSQL 및 JPA 구성
3. 제품 엔티티 생성
4. 제품 리포지토리 생성
5. 제품 서비스 생성
6. 제품 컨트롤러 생성

각 단계를 자세히 살펴보겠습니다.

### 1. 프로젝트 설정

먼저, [Spring Initializr](https://start.spring.io/)에서 새 Spring Boot 프로젝트를 생성합니다. 다음 옵션을 선택합니다.

- 프로젝트: Maven 프로젝트
- 언어: Java
- 패키징: Jar
- Java 버전: 11 이상
- 종속성: Web, JPA, PostgreSQL 드라이버

프로젝트를 생성한 후 자주 사용하는 IDE로 가져옵니다.

### 2. PostgreSQL 및 JPA 구성

`src/main/resources/application.properties` 파일을 열고 PostgreSQL 및 JPA에 대해 다음 구성을 추가합니다:

```
spring.datasource.url=jdbc:postgresql://localhost:5432/mydatabase
spring.datasource.username=myuser
spring.datasource.password=mypassword
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
```

mydatabase`, `myuser` 및 `mypassword`를 실제 데이터베이스 이름, 사용자 이름 및 비밀번호로 바꿉니다.

### 3. 제품 엔티티 생성

`com.example.demo.entity`라는 이름의 새 패키지를 생성하고 해당 패키지 내에 `Product.java`라는 새 클래스를 생성합니다. 다음 코드를 추가합니다:

```java
package com.example.demo.entity;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class Product {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String name;
    private Double price;

    // Getters and setters

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }
}
```

### 4. 제품 리포지토리 생성

`com.example.demo.repository`라는 이름의 새 패키지를 생성하고 해당 패키지 내부에 `ProductRepository.java`라는 새 인터페이스를 생성합니다. 다음 코드를 추가합니다:

```java
package com.example.demo.repository;

import com.example.demo.entity.Product;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface ProductRepository extends JpaRepository<Product, Long> {
}
```

### 5. 제품 서비스 생성

`com.example.demo.service`라는 이름의 새 패키지를 만들고 해당 패키지 내에 `ProductService.java`라는 새 클래스를 생성합니다. 다음 코드를 추가합니다:

```java
package com.example.demo.service;

import com.example.demo.entity.Product;
import com.example.demo.repository.ProductRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductService {

    @Autowired
    private ProductRepository productRepository;

    public List<Product> getAllProducts() {
        return productRepository.findAll();
    }

    public Product getProductById(Long id) {
        return productRepository.findById(id).orElse(null);
    }

    public Product addProduct(Product product) {
        return productRepository.save(product);
    }

    public Product updateProduct(Product product) {
        return productRepository.save(product);
    }

    public void deleteProduct(Long id) {
        productRepository.deleteById(id);
    }
}
```

### 6. 제품 컨트롤러 생성

`com.example.demo.controller`라는 이름의 새 패키지를 생성하고 해당 패키지 내에 `ProductController.java`라는 새 클래스를 생성합니다. 다음 코드를 추가합니다:

```java
package com.example.demo.controller;

import com.example.demo.entity.Product;
import com.example.demo.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/products")
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping
    public List<Product> getAllProducts() {
        return productService.getAllProducts();
    }

    @GetMapping("/{id}")
    public Product getProductById(@PathVariable Long id) {
        return productService.getProductById(id);
    }

    @PostMapping
    public Product addProduct(@RequestBody Product product) {
        return productService.addProduct(product);
    }

    @PutMapping
    public Product updateProduct(@RequestBody Product product) {
        return productService.updateProduct(product);
    }

    @DeleteMapping("/{id}")
    public void deleteProduct(@PathVariable Long id) {
        productService.deleteProduct(id);
    }
}
```

이제 엔드포인트가 있는 Spring Boot를 사용하여 PostgreSQL 데이터베이스의 "products" 테이블에서 레코드를 추가, 업데이트, 삭제 및 검색할 수 있는 간단한 REST API 서버가 생겼습니다. Spring Initializr에서 생성된 메인 클래스(예: `DemoApplication.java`)를 실행하여 애플리케이션을 실행하고 Postman 또는 curl과 같은 도구를 사용하여 엔드포인트를 테스트합니다.