Skip to content

Instantly share code, notes, and snippets.

@ekirastogi
Created October 27, 2015 13:30
Show Gist options
  • Save ekirastogi/725fd50ecd2a1e83c1f6 to your computer and use it in GitHub Desktop.
Save ekirastogi/725fd50ecd2a1e83c1f6 to your computer and use it in GitHub Desktop.
How to register a Filter in spring boot application
package com.ekiras.filter;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import java.io.IOException;
/**
* Created by ekansh on 22/10/15.
*/
@Component
@Order(1)
public class SecurityFilter implements Filter{
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
chain.doFilter(request, response);
}
@Override
public void destroy() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment