Skip to content

Commit

Permalink
fix: swagger config (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
yongbin97 committed Oct 3, 2024
1 parent 312b093 commit dc6ba9b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies {
implementation 'org.springframework.ai:spring-ai-vertex-ai-gemini-spring-boot-starter:1.0.0-SNAPSHOT'

// Swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'

implementation group: 'org.json', name: 'json', version: '20231013'

Expand Down
13 changes: 12 additions & 1 deletion src/main/java/project/backend/common/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SwaggerConfig {
public class SwaggerConfig implements WebMvcConfigurer {

private static final String BEARER_TOKEN_PREFIX = "Bearer";

Expand Down Expand Up @@ -45,4 +47,13 @@ private Info apiInfo() {
.description("스위프 6기 5팀 API") // API에 대한 설명
.version("1.0.0"); // API의 버전
}

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");

registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}

0 comments on commit dc6ba9b

Please sign in to comment.