Final changes for splitting SQL WebGoat and lessons
This commit is contained in:
@ -2,6 +2,7 @@ package org.owasp.webgoat;
|
||||
|
||||
import org.flywaydb.core.Flyway;
|
||||
import org.owasp.webgoat.service.RestartLessonService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
@ -18,16 +19,19 @@ import java.util.Map;
|
||||
public class DatabaseInitialization {
|
||||
|
||||
private final DataSource dataSource;
|
||||
private String driverClassName;
|
||||
|
||||
public DatabaseInitialization(DataSource dataSource) {
|
||||
public DatabaseInitialization(DataSource dataSource,
|
||||
@Value("${spring.datasource.driver-class-name}") String driverClassName) {
|
||||
this.dataSource = dataSource;
|
||||
this.driverClassName = driverClassName;
|
||||
}
|
||||
|
||||
@Bean(initMethod = "migrate")
|
||||
public Flyway flyWayContainer() {
|
||||
return Flyway
|
||||
.configure().configuration(
|
||||
Map.of("driver", "org.hsqldb.jdbc.JDBCDriver"))
|
||||
.configure()
|
||||
.configuration(Map.of("driver", driverClassName))
|
||||
.dataSource(dataSource)
|
||||
.schemas("container")
|
||||
.locations("db/container")
|
||||
@ -38,8 +42,8 @@ public class DatabaseInitialization {
|
||||
@DependsOn("flyWayContainer")
|
||||
public Flyway flywayLessons() {
|
||||
return Flyway
|
||||
.configure().configuration(
|
||||
Map.of("driver", "org.hsqldb.jdbc.JDBCDriver"))
|
||||
.configure()
|
||||
.configuration(Map.of("driver", driverClassName))
|
||||
.dataSource(dataSource)
|
||||
.load();
|
||||
}
|
||||
|
Reference in New Issue
Block a user