Update 64.10. Configure Jetty.md
parent
72072e861b
commit
74c3659ad6
|
@ -1,11 +1 @@
|
|||
### 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;
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue