class RightsService {

    public List<String> getRights() {
        List<String> rights = new ArrayList<>();

        modulesService.activeBusinessApplications().forEach(application -> {
            InstanceInfo instanceInfo = application.getInstances().get(0);
            String serviceName = modulesService.extractServiceName(application.getName());
            try {
                String[] response =
                        restTemplate.getForObject(this.buildRightsEndpointUrl(serviceName), String[].class);
                rights.addAll(Arrays.asList(Objects.requireNonNull(response)));
            } catch(RestClientException e) {
                LOGGER.warn("[getRights] An error occured in module {} : {}", application.getName(), e.getMessage());
            }
        });

        return rights;
    }

    @Autowired public  RightsService(RestTemplateBuilder builder, ModulesService modulesService, DiscoveryUtils discoveryUtils);

}