0

As I can't comment on M.Deinums answer in another post here, I have to open a complete new question:

I just noticed that

spring.datasource.data=file:/somepath/to/somewhere/init-*.sql

works, but not

spring.datasource.data=classpath:/init-*.sql

Wonder why. Didn't find any clue in the docs.

1 Answers1

0

As it is difficult to find special characters with the current search machines, it took a while to finding the solution:

A ResourcePatternResolver implementation that is able to resolve a specified resource location path into one or more matching Resources. The source path may be a simple path which has a one-to-one mapping to a target Resource, or alternatively may contain the special "classpath*:" prefix and/or internal Ant-style regular expressions (matched using Spring's AntPathMatcher utility). Both of the latter are effectively wildcards.

taken from: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/io/support/PathMatchingResourcePatternResolver.html

So, the solution is (mind the asterisk):

spring.datasource.data=classpath:/data.sql,classpath*:/init-*.sql