English 中文(简体)
配置配置 Java EE 6 用于 dev/QA/ prod
原标题:Configure Java EE 6 for dev/QA/prod

我有一个 Java EE 6 应用程序, 我与马文一起建造, 代码在NetBeans 7, 并部署在格拉斯菲什 3.1.2。

问题是,我没有任何死难的简单方法来建造不同的环境,例如 Dev、 QA、 演示、 Prod、 Prod 等。 对于某些东西,我一直在使用一个 Java 类, 里面有一堆静态的获取器, 根据环境常量的值返回数值 。 但这无助于我有条件地设置

  • javax.faces.PROJECT_STAGE (web.xml)
  • database credentials (glassfish-resources.xml)
  • mail servers (glassfish-resources.xml)
  • JPA logging level (persistence.xml)

可能还有其他一些我无法思考的东西 分散在XML文件上

是否有办法定义这些配置文件的多种版本, 并在构建时设置一个标记来选择环境, 而默认为 dev 时没有指定环境 。 在此情况下, 我是否可以让玛文为我工作?

最佳回答
问题回答

This is not direct response to question. This explain diff strategy to manage env properties One other way to manage properties for diff env is using the database to store the properties. This way you have only need to manage the config of the DB. Based on which DB you are pointing you can load the properties from that DB. If you are using spring than spring provides PropertyPlaceholderConfigurer which can initialize the properties from DB. This approach allows you to change the property value without doing a build.

如果您想要推广由 QATesting 团队测试的工艺品, 此方法是有用的 。 在这种情况下, DB 配置将不会是构建过程产生的工艺品的一部分 。

If you need to configure web.xml check this how-to: https://community.jboss.org/docs/DOC-19076

它使用的方法(资源过滤)与另一个答复中描述的方法相同。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签