Skip to content

Commit

Permalink
[DEV-12] Swagger 의존성 추가 (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonjunYou authored Jul 24, 2024
1 parent 4accef0 commit d31b449
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 108 deletions.
69 changes: 35 additions & 34 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,72 +1,73 @@
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.12'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'jacoco'
id 'java'
id 'org.springframework.boot' version '2.7.12'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'jacoco'
}

group = 'ddingdong'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '17'
sourceCompatibility = '17'
}

jar {
enabled = false
enabled = false
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'

implementation 'io.hypersistence:hypersistence-utils-hibernate-55:3.7.2'
implementation 'io.hypersistence:hypersistence-utils-hibernate-55:3.7.2'

implementation 'com.auth0:java-jwt:4.2.1'
implementation 'com.auth0:java-jwt:4.2.1'

implementation 'io.awspring.cloud:spring-cloud-starter-aws:2.4.4'
implementation 'com.mysql:mysql-connector-j'
implementation 'io.awspring.cloud:spring-cloud-starter-aws:2.4.4'
implementation 'com.mysql:mysql-connector-j'

implementation 'org.apache.poi:poi:5.2.0'
implementation 'org.apache.poi:poi-ooxml:5.2.0'
implementation 'org.springframework.boot:spring-boot-configuration-processor'
implementation 'org.apache.poi:poi:5.2.0'
implementation 'org.apache.poi:poi-ooxml:5.2.0'
implementation 'org.springframework.boot:spring-boot-configuration-processor'

implementation 'io.sentry:sentry-logback:7.6.0'
implementation 'io.sentry:sentry-logback:7.6.0'
implementation 'org.springdoc:springdoc-openapi-ui:1.6.11'

compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
useJUnitPlatform()
useJUnitPlatform()
}

jacoco {
toolVersion = '0.8.10'
toolVersion = '0.8.10'
}

test {
finalizedBy jacocoTestReport
finalizedBy jacocoTestReport
}

jacocoTestReport {
reports {
html.enabled true
xml.enabled true
csv.enabled true
}
reports {
html.enabled true
xml.enabled true
csv.enabled true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package ddingdong.ddingdongBE.common.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.servers.Server;
import java.util.List;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OpenApiConfig {

@Value("${swagger.server.url}")
private String serverUrl;

@Bean
public OpenAPI openApi() {
return new OpenAPI()
.components(securityComponents())
.servers(List.of(new Server().url(serverUrl)));
}

private Components securityComponents() {
return new Components()
.addSecuritySchemes(
"AccessToken",
new SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT")
);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ddingdong.ddingdongBE.common.config;

import static org.springframework.http.HttpMethod.*;
import static org.springframework.http.HttpMethod.GET;

import ddingdong.ddingdongBE.auth.service.JwtAuthService;
import ddingdong.ddingdongBE.common.filter.JwtAuthenticationFilter;
Expand Down Expand Up @@ -39,6 +39,7 @@ public SecurityFilterChain filterChain(HttpSecurity http, JwtAuthService authSer
API_PREFIX + "/notices/**",
API_PREFIX + "/banners/**")
.permitAll()
.antMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-resources/**").permitAll()
.anyRequest()
.authenticated()
.and()
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ sentry:
dsn: ${SENTRY_KEY}
enable-tracing: true
environment: dev

swagger:
server:
url: ${SERVER_URL:http://localhost:8080}
7 changes: 0 additions & 7 deletions src/main/resources/console-appender.xml

This file was deleted.

16 changes: 0 additions & 16 deletions src/main/resources/file-error-appender.xml

This file was deleted.

13 changes: 0 additions & 13 deletions src/main/resources/file-info-appender.xml

This file was deleted.

29 changes: 0 additions & 29 deletions src/main/resources/logback-spring.xml

This file was deleted.

8 changes: 0 additions & 8 deletions src/main/resources/sentry-appender.xml

This file was deleted.

0 comments on commit d31b449

Please sign in to comment.