diff --git a/IX. ‘How-to’ guides/64.10. Configure Jetty.md b/IX. ‘How-to’ guides/64.10. Configure Jetty.md index e69de29..d8040b4 100644 --- a/IX. ‘How-to’ guides/64.10. Configure Jetty.md +++ b/IX. ‘How-to’ guides/64.10. Configure Jetty.md @@ -0,0 +1,11 @@ +### 64.10. 禁止注册Servlet或Filter + +正如[以上讨论](http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#howto-add-a-servlet-filter-or-servletcontextlistener)的任何Servlet或Filter beans将被自动注册到servlet容器中。为了禁止注册一个特殊的Filter或Servlet bean,可以为它创建一个注册bean,然后禁用该bean。例如: +```java +@Bean +public FilterRegistrationBean registration(MyFilter filter) { + FilterRegistrationBean registration = new FilterRegistrationBean(filter); + registration.setEnabled(false); + return registration; +} +```