私は次の構成を持っています:
@SpringBootApplication
@EnableFeignClients
public class Application {
@FeignClient(name = "theclient")
public interface TheClient {
...
theclient:
ribbon:
listOfServers: http://server:8080
そして、次のテストを行います。
@RunWith(SpringRunner.class)
@RestClientTest(TheClient.class)
@ImportAutoConfiguration(
classes = {
RibbonAutoConfiguration.class,
FeignRibbonClientAutoConfiguration.class,
FeignAutoConfiguration.class
}
)
public class TheClientTest {
...
私が得るエラーはCaused by: com.netflix.client.ClientException: Load balancer does not have available server for client: theclient
、まるでapplication.yaml
が読まれていないかのようです。ただし、 を含むconfig.properties
ファイルを追加するtheclient.ribbon.listOfServers=http://server:8080
と、テストは機能し、合格します。
@TestPropertySource("classpath:application.yaml")
ログに表示されますpropertySourceLocations = '{classpath:application.yaml}'
が、同じエラーが発生します。
また、次を追加して、リボンを無効にしようとしました。
spring:
cloud:
loadbalancer:
ribbon:
enable: false
しかし、うまくいきません。
ご意見とご協力に感謝いたします。