maven型材或弹簧型材? [英] maven profiles or spring profiles?

查看:125
本文介绍了maven型材或弹簧型材?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很多java应用程序都是用maven构建的。 maven具有Profiles概念,为不同的环境构建版本包是非常方便的。例如 dev / test / prod 使用不同的路径/ jndiname /安全规则/属性文件 ...我想我不



Spring是一个非常好的和流行的java开发框架,因为spring3它也支持个人资料概念。



现在问题来了,为了释放不同的ENV目的,哪一个更好?现在我更喜欢maven的个人资料。因为Spring必须在每个配置文件中复制每个bean定义。并且它需要一个初始化器/属性让spring知道应该激活哪个配置文件。



但是我觉得弹簧配置文件比maven配置文件更灵活。



你觉得怎么样?请给出一些建议。谢谢。

解决方案

Maven配置文件将提供一个构建时间解决方案,而SpringFramework配置文件将提供运行时的替代方案。我认为这是第一个可能会问自己的问题:如果他想要一个可以部署在不同环境中的单一软件包,或者他希望构建工具根据目标环境提供不同的软件包。



有一件事要记住,如果您将不同的软件包部署到不同的服务器中,可能会出现许多问题。例如,在我的工作场所,如果我正在部署一个软件包来纠正以前在生产环境中发生的错误,公司政策将声明唯一可接受的情况是我在质量检查和生产服务器中具有相同的解决方案包。 p>

a lot java applications are build with maven. maven has Profiles concept, it is really handy to build release package for different environments. e.g. dev/test/prod using different path / jndiname / security rule / properties files... I think I don't have to list codes here to explain it.

Spring is a very nice and popular framework for java development, since spring3 it has supported profiles concept too.

Now question comes, for releasing to different ENVs purpose, which one is better? right now I prefer maven profile. since spring has to copy each bean definition in each profile. and it needs an initializer/property to let spring know which profile should be actived.

but I feel spring profile is more flexible than maven profile.

what do you think? please give some advices. thank you.

解决方案

Maven profiles would provide a build-time solution, while SpringFramework profiles would provide a runtime alternative. I think this is the first question one may ask himself: if he wants to have a single package that can be deployed in different environments, or if he wants the build tool to provide different packages according to the destination environment.

One thing to keep in mind is that many questions may arise if you have different packages deployed into different servers. In my workplace, for example, if I am deploying a package to correct a bug previously occurred in production environment, a company policy would state that the only acceptable scenario is that I have the same solution package in QA and in production servers.

这篇关于maven型材或弹簧型材?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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