Spring Ioc容器如何与Tomcat容器交互 [英] How Spring Ioc container interacts with Tomcat container

查看:351
本文介绍了Spring Ioc容器如何与Tomcat容器交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我熟悉Spring框架,并在其中做了一些工作.

I am familiar with the Spring Framework and have done some work in it.

在我的一次采访中,我被问到在 Apache Tomcat 中部署了一个Web应用程序;请告诉我" Tomcat容器"(用于servlet)与"Spring IoC容器"如何交互. (用于Spring bean)?"

In one of my interviews, I was asked "there is a web application deployed in Apache Tomcat; tell me how does the "Tomcat container" (used for servlets) interact with "Spring IoC container" (used for Spring beans)?"

我不明白面试官的意思,因此无语.有人可以澄清这个问题是什么以及对它的合理答案吗?

I couldn't understand what the interviewer meant by that and was left speechless. Can someone please clarify what this question was about and what a reasonable answer to it might be?

推荐答案

Spring Web应用程序将在其配置中定义一个Spring Dispatcher Servlet,apache tomcat容器将初始化此Servlet,调度程序Servlet进而初始化应用程序上下文. . Tomcat容器和Spring IOC容器之间没有直接交互.

A spring web-app will define a Spring Dispatcher Servlet in its config, the apache tomcat container will initialise this servlet, the dispatcher servlet in turn initialises the application context. There is no direct interaction between the tomcat container and the Spring IOC container.

这篇关于Spring Ioc容器如何与Tomcat容器交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆