如何在不同的分段环境中维护java webapps? [英] How do you maintain java webapps in different staging environments?

查看:165
本文介绍了如何在不同的分段环境中维护java webapps?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可能有一组在开发人员机器上使用的属性,这些属性在开发人员和开发人员之间有所不同,另一组是临时环境,另一组是生产环境。

You might have a set of properties that is used on the developer machine, which varies from developer to developer, another set for a staging environment, and yet another for the production environment.

在Spring应用程序中,您可能还想要在本地环境中而不是在生产环境中加载bean,反之亦然。

In a Spring application you may also have beans that you want to load in a local environment but not in a production environment, and vice versa.

如何处理?你使用单独的文件,ant / maven资源过滤还是其他方法?

How do you handle this? Do you use separate files, ant/maven resource filtering or other approaches?

推荐答案

我把JNDI中的各种属性。这样每个服务器都可以配置,我可以有一个war文件。
如果属性列表很大,那么我将在另一个服务器上托管属性(或XML)文件。我将使用JNDI指定要使用的文件的URL。

I just put the various properties in JNDI. This way each of the servers can be configured and I can have ONE war file. If the list of properties is large, then I'll host the properties (or XML) files on another server. I'll use JNDI to specify the URL of the file to use.

如果您为每个环境创建不同的应用程序文件(war / ear)

If you are creating different app files (war/ear) for each environment, then you aren't deploying the same war/ear that you are testing.

在我的一个应用程序中,我们使用了多个REST服务。我只是把根网址JNDI。然后在每个环境中,服务器可以配置为与该环境的适当REST服务通信。

In one of my apps, we use several REST services. I just put the root url in JNDI. Then in each environment, the server can be configured to communicate with the proper REST service for that environment.

这篇关于如何在不同的分段环境中维护java webapps?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆