Spring应用程序上下文:访问web.xml context-params?
问候 ,
有没有办法从web.xml context-param获取值到Spring上下文?
例如,我将web.xml中的值定义为:
compass-index file:///home/compass/index
我想将该值分配给bean属性:
${from web.xml context-param?}
提前致谢?
是 – ServletContextPropertyPlaceholderConfigurer
本文解释了详细信息。 简而言之,您需要:
然后使用以下属性:
或@Value("${compass-index}")