> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/spring-boot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/spring-boot/ix.-how-to-guides/76.-spring-mvc/76.6-switch-off-the-spring-mvc-dispatcherservlet.md).

# 76.6 关闭Spring MVC DispatcherServlet

Spring Boot想要服务来自应用程序root（`/`）下的所有内容。如果你想将自己的servlet映射到该目录下也是可以的，但当然你可能失去一些Spring Boot MVC特性。为了添加你自己的servlet，并将它映射到root资源，你只需声明一个`Servlet`类型的`@Bean`，并给它特定的bean名称`dispatcherServlet`（如果只想关闭但不替换它，你可以使用该名称创建不同类型的bean）。
