Commit 464da4de by Yiming Liu

Update cat bean definition

parent 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% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment