Skip to content

Commit

Permalink
Merge branch 'release/v2.0.0'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.idea/dataSources.local.xml
#	.idea/dataSources.xml
#	.idea/encodings.xml
#	.idea/misc.xml
#	.idea/workspace.xml
  • Loading branch information
seonggil-jeong committed Sep 27, 2022
2 parents 13bbe99 + 97d4035 commit e2564d1
Show file tree
Hide file tree
Showing 149 changed files with 3,397 additions and 775 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
23 changes: 23 additions & 0 deletions .idea/dataSources.local.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

779 changes: 779 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

20 changes: 19 additions & 1 deletion ApiGateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.submarket</groupId>
<artifactId>apigateway</artifactId>
<version>1.0.0</version>
<version>2.0.0</version>
<name>ApiGateway</name>
<description>ApiGateway</description>
<properties>
Expand Down Expand Up @@ -83,6 +83,24 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>

<!-- Micrometer -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

<!-- Zipkin -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
<version>2.2.3.RELEASE</version>
</dependency>

</dependencies>
<dependencyManagement>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion ConfigService/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.submarket</groupId>
<artifactId>configservice</artifactId>
<version>1.0.0</version>
<version>2.0.0</version>
<name>ConfigService</name>
<description>ConfigService</description>
<properties>
Expand Down
13 changes: 12 additions & 1 deletion DiscoveryService/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.submarket</groupId>
<artifactId>discoveryservice</artifactId>
<version>1.0.0</version>
<version>2.0.0</version>
<name>DiscoveryService</name>
<description>DiscoveryService</description>
<properties>
Expand All @@ -33,6 +33,17 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<!-- Zipkin -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
<version>2.2.3.RELEASE</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
Expand Down
62 changes: 52 additions & 10 deletions ItemService/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@
</parent>
<groupId>com.submarket</groupId>
<artifactId>itemservice</artifactId>
<version>1.0.0</version>
<version>2.0.0</version>
<name>ItemService</name>
<description>ItemService</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>2021.0.3-SNAPSHOT</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
Expand Down Expand Up @@ -66,16 +62,18 @@
<version>1.5.0.RC1</version>
</dependency>

<!-- JSON -->
<!-- JPA -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.1</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>

<!-- UsernamePasswordAuthenticationFilter -->
Expand Down Expand Up @@ -143,6 +141,50 @@
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>

<!-- Cache -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>5.6.11.Final</version>
</dependency>

<!-- Resilience4j -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
</dependency>

<!-- Feign Client -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>

<!-- Zipkin -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
<version>2.2.3.RELEASE</version>
</dependency>

<!-- Micrometer -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

<!-- Swagger -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.6</version>
</dependency>

</dependencies>
<dependencyManagement>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;

@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
public class ItemServiceApplication {

public static void main(String[] args) {
Expand Down
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);
}
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());

}
}
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"));
}
}
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";
}
Loading

0 comments on commit e2564d1

Please sign in to comment.