dev 환경이 아니면 h2 console을 사용할 일이 없기 때문에 dev 환경에서만 사용할 수 있게끔 구성한다.
spring:
h2:
console:
enabled: true
@Bean
@ConditionalOnProperty(name = "spring.h2.console.enabled", havingValue = "true")
public WebSecurityCustomizer configureH2ConsoleEnable() {
return web -> web.ignoring()
.requestMatchers(PathRequest.toH2Console());
}