在多环境应用程序上外部化系统属性的最佳方法
我们正在使用一个在多个环境(测试、UAT 和生产)上运行的 Spring 3 应用程序,这些环境由第三方公司管理,因此我们几乎无法访问服务器。
我们尝试过 Jboss 系统属性 和 Maven2 配置文件。两种解决方案都工作得很好,但是我们不想将应用程序绑定到一台特定的服务器(在本例中为 Jboss),并且我们不想进行特定于环境的构建(Maven2 配置文件所需)。
有没有一种好方法可以让应用程序具有特定于环境的属性,不需要为每个环境进行不同的构建,并且不需要在服务器端进行修改,并且也可以在不同的服务器上运行? (某种可以在应用程序上下文之外读取属性文件的 PropertyPlaceHolderConfigurer
应该可以解决问题)
We are working with a Spring 3 application that runs on several environments (test, UAT and Production) these environments are managed by a third party company so we have almost no access to the servers.
We have tried with Jboss System Properties and Maven2 Profiles. Both solutions worked fine, however we don't want to tie the application to one specific Server (Jboss in this case) and we don't want to do environment specific builds (required for Maven2 profiles).
Is there a good way we could have environment specific properties for the app that do not require different builds for each environment and require no modifications on the server side and that could also run on different servers? (some sort of PropertyPlaceHolderConfigurer
that could read property files outside the app context should do the trick)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
特定于环境的构建并不是一个坏选择。
但是 spring 3.1 提供了您正在寻找的东西 - 特定于环境的配置。请参阅此和< a href="http://blog.iprofs.nl/2011/02/27/spring-3-1-environment-specific-configuration/" rel="nofollow">这个
Environment-specific builds are not a bad option.
But spring 3.1 is providing what you are looking for - environment specific configuration. See this and this