Keycloak and spring app running on different docker containers

Hello!
I am trying to use keycloak with my spring application.
They work in docker containers, on the same network.
When I run my application in a docker container (and give all it’s urls to keycloak like: keycloak:8080 ) it either doesn’t work because the login url I get back is keycloak:8080/realms/my-realm/protocol/openid-connect/auth…

or if I change the authorization-uri in my application.yaml, I get to the login page, but after logging in with a user I get:

Login with OAuth 2.0

invalid_id_token An error occurred while attempting to decode the Jwt: The ID Token contains invalid claims: iss=localhost:8080/realms/my-realm

keycloak:8080/realms/my-realm localhost:1234/oauth2/authorization/keycloak

What config/ yaml property should I change, or how can I change my security config so that it works?