서블릿 startup순서 변경
parent
ddd422dcca
commit
9a5b45daa9
@ -0,0 +1,37 @@
|
||||
package cokr.xit.custom.boot;
|
||||
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.filter.CharacterEncodingFilter;
|
||||
|
||||
import cokr.xit.foundation.web.AccessFilter;
|
||||
|
||||
@Configuration
|
||||
public class FilterConfig {
|
||||
protected static String[] URL_PATTERNS = {"/", "*.do"};
|
||||
|
||||
/**CharacterEncodingFilter를 등록한다.
|
||||
* @return FilterRegistrationBean
|
||||
*/
|
||||
@Bean
|
||||
public FilterRegistrationBean<CharacterEncodingFilter> encodingFilter() {
|
||||
FilterRegistrationBean<CharacterEncodingFilter> registration = new FilterRegistrationBean<>();
|
||||
registration.setFilter(new CharacterEncodingFilter("utf-8"));
|
||||
registration.addUrlPatterns(URL_PATTERNS);
|
||||
registration.setOrder(-102);
|
||||
return registration;
|
||||
}
|
||||
|
||||
/**AccessFilter를 등록한다.
|
||||
* @return FilterRegistrationBean
|
||||
*/
|
||||
@Bean
|
||||
public FilterRegistrationBean<AccessFilter> accessFilter() {
|
||||
FilterRegistrationBean<AccessFilter> registration = new FilterRegistrationBean<>();
|
||||
registration.setFilter(new AccessFilter());
|
||||
registration.addUrlPatterns(URL_PATTERNS);
|
||||
registration.setOrder(-101);
|
||||
return registration;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue