Of course you can do it. Try it like this:
@Bean
public RouteLocator gatewayRoutes(RouteLocatorBuilder builder,
@Autowired AccountDiscoveryService discoveryService) {
//Objects.requiredNotNull(discoveryService); //null check if discoveryService can be null
return builder.routes()
.route(r -> r.path("/api/wallet/slot/thunderkick/**") //intercept calls
.uri(discoveryService.getHost()) //forward to
.id("thunderkickModule"))
.build();
}
Also you can move String values to property file. It is better way for configuration classes.
CLICK HERE to find out more related problems solutions.