Skip to content

Commit

Permalink
fix: Java 21 swagger 버전 이슈 (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
char-yb authored Dec 11, 2024
2 parents 3ce8a82 + 3191ae6 commit 2a42726
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ public PasswordEncoder passwordEncoder() {

@Bean
@Order(1)
@ConditionalOnProfile({DEV, LOCAL})
@ConditionalOnProfile({PROD, DEV, LOCAL})
public SecurityFilterChain swaggerFilterChain(HttpSecurity http) throws Exception {
defaultFilterChain(http);

http.securityMatcher(getSwaggerUrls()).httpBasic(withDefaults());

http.authorizeHttpRequests(
springEnvironmentUtil.isDevProfile()
(springEnvironmentUtil.isDevProfile() || springEnvironmentUtil.isProdProfile())
? authorize -> authorize.anyRequest().authenticated()
: authorize -> authorize.anyRequest().permitAll());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,11 @@ private List<Server> swaggerServers() {
}

private String getServerUrl() {
switch (springEnvironmentUtil.getCurrentProfile()) {
case "prod":
return UrlConstants.PROD_SERVER_URL.getValue();
case "dev":
return UrlConstants.DEV_SERVER_URL.getValue();
default:
return UrlConstants.LOCAL_SERVER_URL.getValue();
}
return switch (springEnvironmentUtil.getCurrentProfile()) {
case "prod" -> UrlConstants.PROD_SERVER_URL.getValue();
case "dev" -> UrlConstants.DEV_SERVER_URL.getValue();
default -> UrlConstants.LOCAL_SERVER_URL.getValue();
};
}

private Components authSetting() {
Expand Down

0 comments on commit 2a42726

Please sign in to comment.