分类: Java
2013-05-09 18:00:01
经常是一个项目要在多个环境下部署,有些参数需要经常改变,如数据源连接参数。如果把参数配置在服务器上如tomcat上,就不需要经常修改了。
在applicationContext.xml获取方式如下:
destroy-method="close">
原因如下:
Context Parameters
You can configure named values that will be made visible to the web
application as servlet context initialization parameters by nesting
...
override="false"/>
...
This is equivalent to the inclusion of the following element in the web application deployment descriptor (/WEB-INF/web.xml):
but does not require modification of the deployment descriptor to customize this value.
Spring Expression Language (SpEL)可参考链接如下: