I provide an api for other microservices in my spring boot microservice and I want to put a spring-cloud-gateway in front of this microservice.
I have reviewed the well-known spring document (https://spring.io/guides/gs/gateway/) but as far as I understand it requires me to launch the cloud gateway in a separate project. But I want to run the RouteLocator bean there in my microservice. Not in a separate project, but in the same project.
When I use it in the same project, I get a warning like this
"Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. Please remove spring-boot-starter-web dependency."
Later, as he said in the warning, I remove the spring-boot-starter-web dependency, even coming in other projects, excluding them from there like this
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
<exclusions>
<exclusion>
<artifactId>spring-boot-starter-web</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
</dependency>
This time I logically get the error
"org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.company operations.Service operationsApplication]; nested exception is org.spring. .core.NestedIOException: Failed to load class [javax.servlet.Filter]; nested exception is java.lang.ClassNotFoundException: javax.servlet.Filter ".
We deleted the core library from the project that should provide web api service :D
As a result, can I use cloud gateway in the same project? What is the reason and logic for not using it?
If it is not possible to use it in the same project, how should the well-known practices of gateway be, should I put a gateway in front of each api microservice, or should I have a single gateway in my project consisting of more than one microservice?