Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to configure a Java enterprise application

I have a set of EJBs and other Java classes which need to be configured differently based on the system environment in which they are deployed: production, test, or lab. The configuration information includes stuff like URLs and database connection information.

We'd like to deploy the same exact product (EAR file) in each environment, and have the code then figure out where it is and what its configuration should be, without having to reach out to each deployment server in each environment to make changes.

What is the best way to configure all these components in a centralized, reliable, easy-to-maintain fashion?

Thanks for your thoughts.

like image 774
bhavanki Avatar asked Nov 18 '25 21:11

bhavanki


1 Answers

The best, IMHO, is to use JNDI entries.

You may have to recode some parts of your application in order to use theses entries instead of plain vars, but with this setup:

  • Configuration is server-independant: each vendor provides its own implementation, but spec is a standard.
  • In a clustered environment, config can be persisted in a cluster-wide JNDI tree (see JBoss)
  • Configuration can be changed thru webadmin without restarting server.
like image 84
Pierre-Yves Gillier Avatar answered Nov 20 '25 12:11

Pierre-Yves Gillier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!