title: Spring gateway application unable to find custom filter
body: <p>I'm trying to add a Gateway filter, but for some reason the application can't seem to find the custom filter that I created. This is the error that I get. </p>
  
  <p><a href="https://i.stack.imgur.com/C2ak5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C2ak5.png" alt="enter image description here"></a></p>
  
  <p>My code looks like this:</p>
  
  <p><strong>Application.yml</strong></p>
  
  <pre><code> spring:
    cloud:
      gateway:
        routes:
          - id: securityService
            uri: http://localhost:8083
            predicates:
              - Method=POST
              - Path=/auth/**
            filters:
              - MyGatewayFilterFactory
  </code></pre>
  
  <p><strong>MyGatewayFilterFactory</strong></p>
  
  <pre><code>package com.gateway.cloudstreamproducerrabbitmq;
  
  import org.springframework.cloud.gateway.filter.GatewayFilter;
  import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
  import org.springframework.http.HttpStatus;
  import org.springframework.http.server.reactive.ServerHttpRequest;
  import org.springframework.http.server.reactive.ServerHttpResponse;
  import org.springframework.stereotype.Component;
  import org.springframework.web.server.ServerWebExchange;
  import reactor.core.publisher.Mono;
  
  import java.util.List;
  
  @Component
  public class MyGatewayFilterFactory extends AbstractGatewayFilterFactory&lt;MyGatewayFilterFactory.Config&gt;  {
  
      public MyGatewayFilterFactory() {
          super(Config.class);
      }
  
  
      private boolean isAuthorizationValid(String authorizationHeader) {
          boolean isValid = true;
  
          // Logic for checking the value
          return isValid;
      }
  
      private Mono&lt;Void&gt; onError(ServerWebExchange exchange, String err, HttpStatus httpStatus)  {
          ServerHttpResponse response = exchange.getResponse();
          response.setStatusCode(httpStatus);
  
          return response.setComplete();
      }
  
      @Override
      public GatewayFilter apply(Config config) {
          return (exchange, chain) -&gt; {
              ServerHttpRequest request = exchange.getRequest();
  
              System.out.println("Test");
  
              if (!request.getHeaders().containsKey("Authorization")) {
                  return this.onError(exchange, "No Authorization header", HttpStatus.UNAUTHORIZED);
              };
  
              String authorizationHeader = request.getHeaders().get("Authorization").get(0);
  
              if (!this.isAuthorizationValid(authorizationHeader)) {
                  return this.onError(exchange, "Invalid Authorization header", HttpStatus.UNAUTHORIZED);
              }
  
              ServerHttpRequest modifiedRequest = exchange.getRequest().mutate().
                      header("secret", "RANDOMRANDOMRANDOM").
                      build();
  
  
              return chain.filter(exchange.mutate().request(modifiedRequest).build());
          };
      }
  
      public static class Config {
          // Put the configuration properties
      }
  }
  </code></pre>
  
  <p>If I forgot to provide some information, let me know. I'll update this post. </p>
  
  <p>I haven't worked with filters before so i'm still new to this.</p>