spring_reference/IX. ‘How-to’ guides/65.6. Switch off the Spring...

4 lines
490 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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