J2EE Application / Bean Best Practice Configuration?

What is the best way to manage feature sets to apply to an EJB and can be easily changed between machines / environments (e.g. DEV, TEST, PROD)? For example, is there a way to configure your EJB properties on the application server (which ensures that you can change them by machine / environment).

In particular:

1) I have a Singleton EJB that requires a specific set of properties (environment). Are there annotations that are used to tell the EJB where to look for these properties and automatically apply them to the bean?

2) What is the best way to manage different sets of properties, for example dev, test, prod, so that the J2EE application is portable between servers and you can easily manage the properties specific to each server?

If there are good documentation links, let me know. I figured it out and did not see anything directly in the above paragraphs.

+5
source share
1 answer

I am using the single-element helper class "Properties Helper", which has a Properties member and reads from the xml configuration file the first time it accesses the attempt resource. The assistant encapsulates the entire set of configuration parameters and prevents them from being read from disk more than once.

The file location is specified in my java variants and is read using PropertiesHelper using System.getProperty ()

, , Java , , AOP/Dependency Injection, Google Guice, "".

+2

All Articles