my spring boot version is 1.5.4,here is my config code
@SpringBootApplication
@Configuration
@RestController
@ServletComponentScan
public class Application {
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
@RequestMapping("/")
public String home() {
System.out.println("test");
return "Hello World!";
}
}
here is my servlet filter code
@WebFilter(urlPatterns = "/*")
public class LogFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
System.out.println("LogFilter");
chain.doFilter(request, response);
}
//init and destroy
When i visit http://localhost:8080/ console is out print
LogFilter
test
LogFilter <----the second time
why call filter twice?Spring boot Why do this? Is there a relevant document or source reference?where I want him to call once, how can i do it?
update: thx all the problem has been solved