Closed dreamstar-enterprises closed 2 months ago
I see you have also posted this question on stackoverflow.com. It's always advisable to mention if you've cross-posted somewhere so folks don't end up duplicating effort to help you.
I think stackoverflow.com is probably the best place to get help unless we can determine that this is a bug in Spring Boot.
Hi Phil, Thanks for replying. The reason for posting here as well, is because I do think this is a bug, and so worth bringing to attention to the dev team.
There aren't many lines of code:
Literally, just this in my yaml
## spring settings
spring:
# profile settings
profiles:
active: ssl
# cloud gateway settings
cloud:
gateway:
default-filters:
- DedupeResponseHeader=Access-Control-Allow-Credentials Access-Control-Allow-Origin
routes:
# SPAs assets
- id: angular-ui
uri: ${angular-server-uri}
predicates:
- Path=${angular-prefix}/**
# BFF-server
- id: bff
uri: ${bff-server-uri}
predicates:
- Path=${bff-prefix}/**
filters:
- StripPrefix=1
And then this kotlin class
@SpringBootApplication
class ReverseProxyApplication
fun main(args: Array<String>) {
runApplication<ReverseProxyApplication>(*args)
}
Removing this from my gradle file makes the problem when running bootJar go away. But naturally its a dependency I need for a simple reverse proxy (or any app that uses spring cloud gateway).
implementation("org.springframework.cloud:spring-cloud-starter-gateway")
Is anyone able to replicate to the same error?
Repo (Minimum Reproducable example):
https://github.com/dreamstar-enterprises/docs/tree/master/Spring%20BFF/ReverseProxy
The reason for posting here as well, is because I do think this is a bug, and so worth bringing to attention to the dev team.
That's understandable, but please provide a reference to the stackoverflow.com question so that we know it exists.
I don't think this is a bug, it looks like a misconfiguration of your build.gradle.kts
file. I've edited by previous answer with a fix.
Hi Phil,
Thanks for solving it, and being so helpful.
I wondered. Do you do consultancy work? I'm struggling with a handlful of issues with a Spring BFF I'm trying to implement. (it uses Spring Cloud Gateway and Spring OAuthClient), mainly for storing session data to redis, and relaying tokens.
Would be grateful if you could let me know. I can email you more on the details.
Sorry, the open source work consumes almost all my time so I don't do consulting. But thanks for the kind words.
I have a fairly simple Spring Boot app. One yaml file with spring gateway configurations, and then one file with the main Application class and the main function.
I build the jar file as follows:
It gets built without problems.
The build.gradle.kts file looks like this:
However, when I run this
I keep getting:
I'm not really sure where I am going wrong?
Can someone help?
UPDATE
The below did not help. Any ideas?
UPDATE 2
If I comment this out from the gradle file,
It works. Only problem is that since this is a reverse proxy, its a dependency I very much need.