Java EE getting information about what environment the application is currently running
You can run a Java EE application in a test environment, a development environment or a production one.
How can I use Java code or XML to get hold of that information?
if ( ApplicationContext.inDevelopment() { // do this }
Obviously the above is not correct. But you get the point. How c开发者_高级运维an I do this?
there are many ways to achieve it.
check ip address of the sever to decide which platform it is running on.
add -D property into your server start script, in your program get
the system property.for different platforms using different properties files. each
properties file contains a "platform" propertyor if you are using maven to build your application, you can create
profiles, to set property/attribute at building time.
...
精彩评论