Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HikariCP is trying to set all properties declared the properties file #88

Closed
manikantag opened this issue Jun 3, 2014 · 2 comments
Closed

Comments

@manikantag
Copy link

I m trying to have single config properties file for the project, and so giving all the properties (both hikariCP related and project specific properties) in one properties file.

But on server startup, HikariCP trying to set all the properties defined in the properties file and complains that it could not found a setter method for those non-HikariCP specific properties.

Exception thrown is:

... 44 more
Caused by: java.beans.IntrospectionException: Method not found: setTest
at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:93)
at com.zaxxer.hikari.util.PropertyBeanSetter.setProperty(PropertyBeanSetter.java:97)

Is this a bug or working as per design (if working as per design, can we make it not to look for other properties)?

Thanks

@brettwooldridge
Copy link
Owner

This is as designed. The property setter is reflection based. If the property exists in the file, it tries to set the property on the bean. Without the ability to fail on error, we would loose the ability to inform the user when they have simply misspelled a property.

What other libraries have you found that will silently ignore unknown properties?

@manikantag
Copy link
Author

I've seen how HikariCP loads the properties file. I see the advantages with this approach: even I mistyped some property name, HikariCP will catch me, for good.

One other thing we can do and still show appropriate message when some required parameter is not present is by looking for required properties in the properties file and then throwing error when not found in the properties file. But, this way we can't handle optional properties - for ex, user is giving some optional property, but with a typo in it's name, then HikariCP can't catch that.

Fair enough. One more dedicated properties file just for HikariCp won't hurt much.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants