mardi 24 octobre 2017

How to configure list of Servers for Ribbon when Spring Boot Test WebEnvironment is set to RANDOM_PORT

I have the following config for Ribbon in application.yml in order to Feign work correctly.

ribbon:
    listOfServers: http://localhost:8080

My IntegrationTest annotation configuration looks like this:

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = TestApplication.class)

However when set to RANDOM_PORT Integration tests fail and I'm getting feign.RetryableException: Connection refused. Because Feign is looking for tests on port 8080 but they are on a random port. When set to DEFINED_PORT all tests pass successfully. How should I configure list of servers for Ribbon in order to Feign look for random ports produced by SpringBoot?

Aucun commentaire:

Enregistrer un commentaire