gasparbarancelli / spring-native-query

"Spring Native Query" library to facilitate the execution of native queries, with a focus on simplifying the source code, making it more readable and clean, creating files that contain the native queries and dynamically injecting assets to execute those queries.
https://gasparbarancelli.github.io/spring-native-query/
MIT License
43 stars 11 forks source link

NullPointerException during programatically configuring the library #17

Closed milanov closed 4 years ago

milanov commented 4 years ago

Describe the bug The PropertyUtil#getYamlValue throws a null pointer exception if there is no native-query configuration in the yaml file:

Map<String, String> map = (HashMap<String, String>) obj.get("native-query");
return Optional.ofNullable(map.get(propertyName.replace("native-query.", "")));

To Reproduce Try to define a class to configure a class that extends NativeQueryConfig, but don't include any native-query configuration in an existing yaml file.

Expected behavior It should work without having to include any configuration in the properties file.

gasparbarancelli commented 4 years ago

I released a new version of the library, update it!