-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # .idea/dataSources.local.xml # .idea/dataSources.xml # .idea/encodings.xml # .idea/misc.xml # .idea/workspace.xml
- Loading branch information
Showing
149 changed files
with
3,397 additions
and
775 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,5 @@ | ||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
16 changes: 16 additions & 0 deletions
16
ItemService/src/main/java/com/submarket/itemservice/client/UserServiceClient.java
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 @@ | ||
package com.submarket.itemservice.client; | ||
|
||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
|
||
@FeignClient(name = "USER-SERVICE") | ||
public interface UserServiceClient { | ||
|
||
// Gateway 를 통과하지 않고 내부 통신으로 이동하기 때문에 "/user-service" 가 필요하지 않음 | ||
@GetMapping("/users/{userId}/items/{itemSeq}/liked") | ||
ResponseEntity<Integer> isLikedByUserId(@PathVariable int itemSeq, @PathVariable String userId); | ||
} |
32 changes: 32 additions & 0 deletions
32
ItemService/src/main/java/com/submarket/itemservice/coinfig/Resilience4JConfig.java
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,32 @@ | ||
package com.submarket.itemservice.coinfig; | ||
|
||
import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig; | ||
import io.github.resilience4j.timelimiter.TimeLimiterConfig; | ||
import org.springframework.cloud.circuitbreaker.resilience4j.Resilience4JCircuitBreakerFactory; | ||
import org.springframework.cloud.circuitbreaker.resilience4j.Resilience4JConfigBuilder; | ||
import org.springframework.cloud.client.circuitbreaker.Customizer; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import java.time.Duration; | ||
|
||
@Configuration | ||
public class Resilience4JConfig { | ||
|
||
@Bean | ||
public Customizer<Resilience4JCircuitBreakerFactory> globalCustomConfiguration() { | ||
CircuitBreakerConfig circuitBreakerConfig = CircuitBreakerConfig.custom() | ||
.failureRateThreshold(4) // Open or False 100 중 4 번 실패 시 Open | ||
.waitDurationInOpenState(Duration.ofMillis(1000)) // Open time (1s) | ||
.slidingWindowType(CircuitBreakerConfig.SlidingWindowType.COUNT_BASED) // 수 or 시간 기반 | ||
.slidingWindowSize(2).build(); | ||
|
||
TimeLimiterConfig timeLimiterConfig = TimeLimiterConfig.custom() | ||
.timeoutDuration(Duration.ofSeconds(4)).build(); | ||
|
||
return factory -> factory.configureDefault(id -> new Resilience4JConfigBuilder(id) | ||
.timeLimiterConfig(timeLimiterConfig) | ||
.circuitBreakerConfig(circuitBreakerConfig).build()); | ||
|
||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
ItemService/src/main/java/com/submarket/itemservice/coinfig/SwaggerConfig.java
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,44 @@ | ||
package com.submarket.itemservice.coinfig; | ||
|
||
import io.swagger.v3.oas.models.OpenAPI; | ||
import io.swagger.v3.oas.models.info.Info; | ||
import io.swagger.v3.oas.models.security.SecurityRequirement; | ||
import io.swagger.v3.oas.models.security.SecurityScheme; | ||
import org.springdoc.core.GroupedOpenApi; | ||
import org.springdoc.core.customizers.OpenApiCustomiser; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class SwaggerConfig { | ||
|
||
@Bean | ||
public GroupedOpenApi publicApi() { | ||
return GroupedOpenApi.builder() | ||
.group("ItemServiceAPI") | ||
.pathsToMatch("/**") | ||
.addOpenApiCustomiser(buildSecurityOpenApi()) // JWT Setting Config | ||
.build(); | ||
} | ||
|
||
/** | ||
* JWT Token Setting Config | ||
* @return | ||
*/ | ||
public OpenApiCustomiser buildSecurityOpenApi() { | ||
return OpenApi -> OpenApi.addSecurityItem(new SecurityRequirement().addList("jwt token")) | ||
.getComponents() | ||
.addSecuritySchemes("jwt token", new SecurityScheme() | ||
.name("Authorization") | ||
.type(SecurityScheme.Type.HTTP) | ||
.in(SecurityScheme.In.HEADER) | ||
.bearerFormat("JWT") | ||
.scheme("bearer")); | ||
} | ||
@Bean | ||
public OpenAPI springShopOpenAPI() { | ||
return new OpenAPI() | ||
.info(new Info().title("SubMarket - ITEM-SERVICE API") | ||
.description("SubMarket ItemService API 명세서").version("v2.0.0")); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
ItemService/src/main/java/com/submarket/itemservice/constants/S3Constants.java
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,11 @@ | ||
package com.submarket.itemservice.constants; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class S3Constants { | ||
public final static String IMAGE_FOLDER_PATH = "images"; | ||
} |
Oops, something went wrong.