-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
- 개발언어: 자바 | ||
- IDE: IntellJ(Community Edition) | ||
- 프로젝트 SDK: JDK 11 이상 | ||
- 의존성 관리 툴: Maven | ||
|
||
1. 환경 세팅(기본 프로젝트 셋팅시) | ||
|
||
~~~java | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.fakeapi.example</groupId> | ||
<artifactId>FakeAPI</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.6.9</version> | ||
</parent> | ||
// 자식 POM 파일은 부모 POM 파일에 설정된 의존 관계를 그대로 상속 받을 수 있다. | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-devtools</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> | ||
~~~ | ||
Trouble Shooting -> maven 프로젝트 로딩이 되지 않을때 수동 로딩 | ||
<img width="1450" alt="image" src="https://github.com/HJC96/WebDev/assets/87226129/9b09144a-9f0e-454d-be01-2e4b80a12041"> | ||
|
||
|
||
application.properties | ||
~~~java | ||
server.port = 18080 | ||
server.tomcat.connection-timeout = 30s | ||
server.tomcat.threads.max = 100 | ||
server.tomcat.threads.min-spare = 100 | ||
server.tomcat.accesslog.enabled = true | ||
server.tomcat.accesslog.suffix = log | ||
server.tomcat.accesslog.prefix = access_log | ||
server.tomcat.accesslog.rename-on-rotate = true | ||
~~~ | ||
|
||
Trouble Shooting -> spring boot와 swagger ui 버전이 맞지 않아, 톰캣서버 실행이 되지 않았음. | ||
|
||
다음과 같이 pom.xml 의존성업데이트해주고, SwaggerConfig 파일에 ```@EnableWebMvc```` 어노테이션 추가 | ||
~~~pom.xml | ||
<dependency> | ||
<groupId>io.springfox</groupId> | ||
<artifactId>springfox-boot-starter</artifactId> | ||
<version>3.0.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.springfox</groupId> | ||
<artifactId>springfox-swagger-ui</artifactId> | ||
<version>3.0.0</version> | ||
</dependency> | ||
~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## API 명세 | ||
|
||
GET /products | ||
- 모든 데이터 product | ||
|
||
GET /products/1 | ||
- id가 1인 product | ||
|
||
GET /products?limit=5 | ||
- 5건의 데이터 | ||
|
||
GET /products/categories | ||
- 카테고리 정보를 읽어온다 | ||
|
||
GET /products/category/jewelery | ||
- jewelery 아래에 있는 product를 가져온다 |