Skip to content

Commit 44aea3b

Browse files
committed
get fixtures from dir specified in bootstrap.db-fixtures-path
1 parent 9a5c110 commit 44aea3b

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/main/java/org/fairdatapoint/config/BootstrapConfig.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.springframework.data.repository.init.Jackson2RepositoryPopulatorFactoryBean;
3232

3333
import java.io.IOException;
34+
import java.nio.file.Path;
3435
import java.util.Arrays;
3536
import java.util.Comparator;
3637

@@ -48,7 +49,9 @@ public Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() {
4849
final Jackson2RepositoryPopulatorFactoryBean factory = new Jackson2RepositoryPopulatorFactoryBean();
4950
// load all json resources from the fixtures dir
5051
try {
51-
final Resource[] resources = resourceResolver.getResources("classpath:fixtures/*.json");
52+
// collect fixture resources
53+
final Path fixturesPath = Path.of(bootstrapProperties.getDbFixturesPath(), "*.json");
54+
final Resource[] resources = resourceResolver.getResources("file:" + fixturesPath);
5255
// sort resources to guarantee lexicographic order
5356
Arrays.sort(
5457
resources,

src/main/java/org/fairdatapoint/config/properties/BootstrapProperties.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@
3636
public class BootstrapProperties {
3737
private boolean enabled;
3838
private String dataPath;
39+
private String dbFixturesPath;
3940
}

src/main/resources/application.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,4 @@ server:
115115
bootstrap:
116116
enabled: true
117117
data-path: '/data'
118+
db-fixtures-path: "fixtures"

0 commit comments

Comments
 (0)