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.
精彩评论