提交 464da4de 编写于 作者: Y Yiming Liu

Update cat bean definition

上级 2c387e32
package com.ctrip.apollo.common.controller;
import javax.servlet.DispatcherType;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.boot.context.embedded.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -10,12 +14,20 @@ import com.dianping.cat.servlet.CatListener;
public class CatConfig {
@Bean
public CatFilter catFilter() {
return new CatFilter();
public FilterRegistrationBean catFilter() {
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new CatFilter());
bean.setName("cat-filter");
bean.addUrlPatterns("/*");
bean.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.FORWARD);
return bean;
}
@Bean
public CatListener catListener() {
return new CatListener();
public ServletListenerRegistrationBean<CatListener> catListener() {
ServletListenerRegistrationBean<CatListener> bean =
new ServletListenerRegistrationBean<CatListener>(new CatListener());
bean.setName("cat-listener");
return bean;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册