2013-08-18 85 views
1

我想知道弹簧容器实际上是如何装载到服务器上的,以及有多少种方法可以完成 以及服务器如何知道它必须启动弹簧容器。 我试图谷歌它,但没有运气。弹簧容器如何启动以及如何加载弹簧容器

+1

*“我试图谷歌它,但没有运气。”* - 你有没有尝试阅读Spring文档? –

回答

1

最简单的解决方案是使用ContextLoaderListener

<listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
</listener> 

<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>/WEB-INF/applicationContext*.xml</param-value> 
</context-param> 

http://static.springsource.org/spring/docs/4.0.x/spring-framework-reference/html/web-integration.html了解详情。

+0

,如果我们没有使用web.xml,并且所有配置都是使用WebApplicationInitializer完成的,那么在这种情况下,服务器将会知道它必须从实现WebApplicationInitializer的类中进行配置, –

相关问题