I am running my application in TomEE 8. I want to read some property from my DB and pass it to application.
I saw one example from https://rmannibucau.wordpress.com/2014/08/06/tomee-and-more-advanced-resource-configuration/ . may be it is old. it is not working . while deploying application it expect the Resource Type. But example doesn't have Type in resource tag.
<Resource id="..." properties-provider="com.foo.MyPropertiesReader" />
What is the latest/correct way to load my custom properties to my application from my DB ?
I believe that Romain was trying to be concise in his examples. In his examples, it can be surmised that he was using
javax.sql.DataSourceorDataSource. Despite that, though, this will work for any type of resource, even custom resources. There are also already implementations that you can check out:In the page you mentioned, Romain also notes that your class can either implement
org.apache.openejb.api.resource.PropertiesResourceProvider, or supply aProperties provides();method.Here is a small example:
org.superbiz.provider.MyPropertiesReader.java
src/main/webapp/WEB-INF/resources.xml
These are the key snippets that I hope will help clear your doubts. Implementation of the datasource is left for you to code. :)