开发者

Spring application context : webapp folder variable?

Greetings,

Is there any Spring variable for Web application folder? I want to assign a bean property as following.

Where ${WEBAPP-FOLDER} is the absolute path of the web-app folder.

Any tips?

<bean id="compass" class="org.compass.spring.LocalCompassBea开发者_运维知识库n">
            .
                .
                <prop key="compass.engine.connection">file:///${WEBAPP-FOLDER}/WEB-INF/searchIndex</prop>       
</bean>


No, but you can obtain it through a ServletContextListener, by calling

event.getServletContext.getRealPath("/")

You can now set it in a static variable (which will logically be a constant), or get the spring application context and set it manually (via WebApplicationUtils) in the bean.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜