Kotlin Spring Boot is overriding values of yaml file

I have this yaml file:

gateway:
v1:
url: urlV1
v2:
url: urlV2
token: xyz

 

My problem is that the file is not being properly parsed in my kotlin spring application. This is my code:

 

@Configuration
class GatewayConfig {

@Bean("gateway.v2")
fun paymentApiClient(environment: Environment) = PaymentApiClient(
environment.getRequiredProperty("url"),
environment.getRequiredProperty("token")
)

@Bean("gateway.v1")
fun gatewayClient(environment: Environment) = GatewayClient(environment.getRequiredProperty("url"))

}

Both Beans paymentApiClient and gatewayClient are getting the same value for url parameter. They are getting "urlV2"

 

I was expecting that gatewayClient gets "urlV1" and paymentApiClient gets "urlV2".

Why is that happening? It looks like a spring bug for me..

 

Thanks

 

 

0

Please sign in to leave a comment.