You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and making the http://localhost:8080/api/init?seed=1&how-many-books=100 request I'm getting MissingLocaleException.
The logs show: Loading definitions from: [BOOT-INF/classes/dummy4j/en/book.yml]
instead of Loading definitions from: [dummy4j/en/book.yml, …]
Adding another condition specifically for Spring Boot projects in YamlFileLoader::isInAllowedPath seems to fix the problem, but there must be a better way that doesn't require hardcoding:
Good find, there are some issues in versions 0.7.2 and earlier when it comes to using Dummy4j in jars.
I have fixed this in version 0.7.3, at least mostly. There should now be no issues when using Dummy4j in Spring Boot. Unfortunately, I had to hardcode the "BOOT-INF/classes/" prefix, as I could not figure out a better solution for the time being.
While this issue is fixed, I will leave this issue open for now, to act as a reminder that the resource loading code needs some refactoring.
As for the refactoring, an idea to pursue could be to use the ResourceStreamProvider::get method to get a list of all files in the client's classpath (and somehow try to get their prefix), but that's for another day.
Example application: efficient-mvp-example
After building application with the following command:
mvn clean package && java -jar -Dspring.profiles.active=dev,init target/efficient-mvp-example-0.0.1-SNAPSHOT.jar
and making the
http://localhost:8080/api/init?seed=1&how-many-books=100
request I'm gettingMissingLocaleException
.The logs show:
Loading definitions from: [BOOT-INF/classes/dummy4j/en/book.yml]
instead of
Loading definitions from: [dummy4j/en/book.yml, …]
Adding another condition specifically for Spring Boot projects in
YamlFileLoader::isInAllowedPath
seems to fix the problem, but there must be a better way that doesn't require hardcoding:Useful links:
Resource pattern filter for complete resource path #148
The text was updated successfully, but these errors were encountered: