Skip to content

Commit

Permalink
Merge pull request #7 from taco-official/KL-62/h-2-db-연결
Browse files Browse the repository at this point in the history
feat(KL-62): connect h2 database
  • Loading branch information
ohhamma authored Jul 17, 2024
2 parents f6d154e + 2e5e57e commit 8862221
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/taco/klkl/security/SecurityConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package taco.klkl.security;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.security.servlet.PathRequest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;

@EnableWebSecurity
@Configuration
public class SecurityConfig {

@Bean
@ConditionalOnProperty(name = "spring.h2.console.enabled", havingValue = "true")
public WebSecurityCustomizer configureH2ConsoleEnable() {
return web -> web.ignoring()
.requestMatchers(PathRequest.toH2Console());
}

}
15 changes: 15 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
spring.application.name=klkl

spring.datasource.url=jdbc:h2:mem:klkldb;

spring.datasource.driverClassName=org.h2.Driver

spring.datasource.username=sa

spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

spring.jpa.hibernate.ddl-auto=create

spring.h2.console.enabled=true

spring.h2.console.path=/h2-console

0 comments on commit 8862221

Please sign in to comment.