health check 추가

This commit is contained in:
Hyojin Ahn 2026-06-09 12:31:30 -04:00
parent 498e0b73c1
commit 445fc24862
2 changed files with 5 additions and 0 deletions

View File

@ -34,6 +34,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
// OpenAPI (Swagger UI) // OpenAPI (Swagger UI)
implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:${springdocVersion}" implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:${springdocVersion}"

View File

@ -15,6 +15,9 @@ import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest;
import org.springframework.boot.actuate.health.HealthEndpoint;
import jakarta.servlet.DispatcherType; import jakarta.servlet.DispatcherType;
@Configuration @Configuration
@ -35,6 +38,7 @@ public class SecurityConfig {
.authorizeHttpRequests(auth -> auth .authorizeHttpRequests(auth -> auth
.dispatcherTypeMatchers(DispatcherType.ERROR).permitAll() .dispatcherTypeMatchers(DispatcherType.ERROR).permitAll()
.dispatcherTypeMatchers(DispatcherType.FORWARD).permitAll() .dispatcherTypeMatchers(DispatcherType.FORWARD).permitAll()
.requestMatchers(EndpointRequest.to(HealthEndpoint.class)).permitAll()
.requestMatchers("/swagger-ui/**", "/v3/api-docs/**").permitAll() .requestMatchers("/swagger-ui/**", "/v3/api-docs/**").permitAll()
.anyRequest().authenticated() .anyRequest().authenticated()
) )