diff --git a/docker-compose.yml b/docker-compose.yml index 6473d4d3..e0f99920 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -64,7 +64,7 @@ services: SERVICE_NAME: user container_name: user-service ports: - - 8082:8082 + - 8081:8081 environment: - EUREKA_CLIENT_SERVICEURL_DEFAULTZONE=${EUREKA_URL} - SPRING_CLOUD_CONFIG_URI=${CONFIG_SERVER_URI} diff --git a/gateWay/build.gradle b/gateWay/build.gradle index 419a019c..e660c745 100644 --- a/gateWay/build.gradle +++ b/gateWay/build.gradle @@ -18,6 +18,13 @@ repositories { mavenCentral() } +configurations { + all { + exclude group: 'org.springframework.boot', module: 'spring-boot-starter-web' + exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat' + } +} + dependencies { // JWT (분리된 구조) implementation 'io.jsonwebtoken:jjwt-api:0.12.6' @@ -26,14 +33,17 @@ dependencies { // Spring Boot implementation 'org.springframework.boot:spring-boot-starter-actuator' - implementation 'org.springframework.boot:spring-boot-starter-security' // Spring Cloud implementation 'org.springframework.cloud:spring-cloud-starter-gateway-server-webflux' implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' - // WebFlux Security - implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' // JWT 검증 + // lombok + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + + // 공통 모듈 + implementation 'com.github.ElevenHub:HubEleven-common:v0.0.1' // lombok compileOnly 'org.projectlombok:lombok' diff --git a/user/src/main/java/com/hubEleven/user/UserApplication.java b/user/src/main/java/com/hubEleven/user/UserApplication.java index 913921c7..7a9edac4 100644 --- a/user/src/main/java/com/hubEleven/user/UserApplication.java +++ b/user/src/main/java/com/hubEleven/user/UserApplication.java @@ -1,14 +1,21 @@ package com.hubEleven.user; +import com.commonLib.common.exception.GlobalExceptionHandler; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.FilterType; @SpringBootApplication @ComponentScan( basePackages = { "com.hubEleven.user", // 현재 서비스 패키지 "com.commonLib.common" // 공통 모듈 패키지 + }, + excludeFilters = { + @ComponentScan.Filter( + type = FilterType.ASSIGNABLE_TYPE, + classes = GlobalExceptionHandler.class) }) public class UserApplication { diff --git a/user/src/main/java/com/hubEleven/user/infrastructure/config/OpenApiConfig.java b/user/src/main/java/com/hubEleven/user/infrastructure/config/OpenApiConfig.java index d982678e..037a90fc 100644 --- a/user/src/main/java/com/hubEleven/user/infrastructure/config/OpenApiConfig.java +++ b/user/src/main/java/com/hubEleven/user/infrastructure/config/OpenApiConfig.java @@ -5,6 +5,7 @@ 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 io.swagger.v3.oas.models.servers.Server; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -19,6 +20,7 @@ public OpenAPI customOpenAPI() { .title("User Service API") .version("1.0") .description("User Service API with JWT Authentication")) + .addServersItem(new Server().url("http://localhost:8081").description("Local server")) .addSecurityItem(new SecurityRequirement().addList("Bearer Authentication")) .components( new Components() diff --git a/user/src/main/java/com/hubEleven/user/infrastructure/exception/UserGlobalExceptionHandler.java b/user/src/main/java/com/hubEleven/user/infrastructure/exception/UserGlobalExceptionHandler.java index ba69f3c0..08bf30ac 100644 --- a/user/src/main/java/com/hubEleven/user/infrastructure/exception/UserGlobalExceptionHandler.java +++ b/user/src/main/java/com/hubEleven/user/infrastructure/exception/UserGlobalExceptionHandler.java @@ -1,7 +1,9 @@ package com.hubEleven.user.infrastructure.exception; import com.commonLib.common.exception.GlobalExceptionHandler; +import io.swagger.v3.oas.annotations.Hidden; import org.springframework.web.bind.annotation.RestControllerAdvice; -@RestControllerAdvice +@Hidden +@RestControllerAdvice(basePackages = "com.hubEleven.user.presentation.controller") public class UserGlobalExceptionHandler extends GlobalExceptionHandler {}