Spring Boot with Filter
in Java with 16048 comments

Spring Boot with Filter

in Java with 16048 comments

@WebFilter

Use FilterRegistrationBean

Filter with Autowire

Code Piece

WebFilterConfiguration

@SpringBootConfiguration
public class WebFilterConfiguration {
  @Bean
  public FilterRegistrationBean<BasicAuthFilter> basicAuthFilterFilterRegistrationBean() {
    FilterRegistrationBean<BasicAuthFilter> filterFilterRegistrationBean =
      new FilterRegistrationBean<>();
    filterFilterRegistrationBean.setFilter(getBasicAuthFilter());
    filterFilterRegistrationBean.addUrlPatterns("/open/*");
    filterFilterRegistrationBean.setOrder(Ordered.LOWEST_PRECEDENCE - 1);
    return filterFilterRegistrationBean;
  }
  @Bean
  public BasicAuthFilter getBasicAuthFilter() {
    return new BasicAuthFilter();
  }
}

Filter

public class BasicAuthFilter implements Filter {
  @Autowired private PathMatcher pathMatcher;
  @Autowired private ResourceService resourceService;
  @Autowired private UrlPathHelper urlPathHelper;

  @Override
  public void init(FilterConfig filterConfig) throws ServletException {}

  @Override
  public void doFilter(
  ......
}  

Cont.

Responses
  1. Wonderful facts, Thanks.
    http://canadian1pharmacy.com viagra online

    Reply
  2. cialis generic purchase

    buy cialis online without a prescription

    cheap cialis online

    buy online cheap cialis generic

    Reply
  3. http://casinoslotsww.com/# casino blackjack http://casinogamesejk.com/# - slots online online slots

    Reply
  4. casino bonus codes gold fish casino slots slot games vegas casino slots no deposit casino

    Reply
  5. best online casino free slots games online gambling

    Reply
  6. http://creditscoresids.com/# credit report agencies credit karma check my credit score what is credit score average credit score

    Reply