Skip to content

Instantly share code, notes, and snippets.

@cherniag
Last active August 16, 2021 10:08
Show Gist options
  • Save cherniag/ae6812bb1a1938b5443a2dd5925c5fc9 to your computer and use it in GitHub Desktop.
Save cherniag/ae6812bb1a1938b5443a2dd5925c5fc9 to your computer and use it in GitHub Desktop.
ribbon fix
def contextsField = ReflectionUtils.findField(SpringClientFactory, "contexts")
contextsField.setAccessible(true)
def contexts = ReflectionUtils.getField(contextsField, springClientFactory)
contexts.clear()
def staticServerList = new StaticServerList(new Server("localhost", wireMockPort))
// add services here
["service-name"].each { name ->
def balancer = springClientFactory.getLoadBalancer(name)
balancer.setServerListImpl(staticServerList)
balancer.updateListOfServers()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment