I have a legacy web application that I want to secure it by using a Spring cloud gateway with Outh2.
Without Outh2, the Spring cloud gateway worked with the following application.yml
spring:
cloud:
gateway:
routes:
- id: my_route
uri: http://MyLegacyServer:8080
predicates:
- Path=/**
But when I added the keycloak definition to it like the following
keycloak:
auth-server-url: http://localhost:8083/auth
realm: xxx
resource: login-app
public-client: true
I was getting the following error when at start
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration$SpringMvcFoundOnClasspathConfiguration': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration$SpringMvcFoundOnClasspathConfiguration]: Constructor threw exception; nested exception is org.springframework.cloud.gateway.support.MvcFoundOnClasspathException