Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Best way to include modifiable config parameters?
Hopefully a simple answer to this? I have a Vaadin app I deploy as a WAR, however it needs a DB connection which I'd like to come from a config file so the end user can just edit that file and restart the app.
What's the best way to go about making this happen?
There are many ways to do this.
1) Maintain the config file in user.home folder, read it in ServletContextListener or in Singleton bean (in case you use JEE6) and access then from your app.
2) Use java system properties - your user can set db connection info by applying java system properties in application server configuration file and your app can read them by calling System.getProperty ("xxxx");
3) Use JNDI - define your app unique jndi connection name, say, jdbc/myapp and consume it. Note your users that they have to create such resource in the app server.
If DB connection is the only the parameter you need to have in your app - I would recommend third variant.
If you plan to have more setting options in your app - number 1 is probably a better way. In any case, I would recommend using #3 for database connections as app servers provides such features like connection pooling, load balancing, etc for jdbc connections, so you don't have to do this yourself in your app. So your configuration file could maintain a jndi name for your connection, not the full DB connection properties set.
This was a huge help, thanks :)