@Test public void throwsExceptionForInvalidServiceFactoryConfig() { String config = "" + "multi:\n" + " factories:\n" + " backendProvider:\n" + " enabled: false\n" + " config:\n" + " stringValue: valueNumber1\n"; Environment env = environmentWithConfig(config); Exception e = assertThrows(ConfigurationException.class, () -> loadServices(env.configuration(), env, "multi", StyxService.class)); assertThat(e.getMessage(), matchesPattern("Unexpected configuration object 'services.factories.backendProvider', Configuration.*'")); }
public static <T> Map<String, T> loadServices(Configuration configuration, Environment environment, String key, Class<? extends T> serviceClass) { return configuration.get(key, JsonNode.class) .<Map<String, T>>map(node -> servicesMap(node, environment, serviceClass)) .orElse(emptyMap()); }
ServiceProvision { public static <T> Map<String, T> loadServices(Configuration configuration, Environment environment, String key, Class<? extends T> serviceClass) { return configuration.get(key, JsonNode.class) .<Map<String, T>>map(node -> servicesMap(node, environment, serviceClass)) .orElse(emptyMap()); } }
ServiceProvision { public static <T> Map<String, T> loadServices(Configuration configuration, Environment environment, String key, Class<? extends T> serviceClass) { return configuration.get(key, JsonNode.class) .<Map<String, T>>map(node -> servicesMap(node, environment, serviceClass)) .orElse(emptyMap()); } private  ServiceProvision(); }
ServiceProvision { public static <T> Map<String, T> loadServices(Configuration configuration, Environment environment, String key, Class<? extends T> serviceClass) { return configuration.get(key, JsonNode.class) .<Map<String, T>>map(node -> servicesMap(node, environment, serviceClass)) .orElse(emptyMap()); } private  ServiceProvision(); static Optional<E> loadLoadBalancer(
            Configuration configuration,
            Environment environment,
            String key,
            Class<? extends E> serviceClass,
            ActiveOrigins activeOrigins); static Optional<E> loadRetryPolicy(
            Configuration configuration,
            Environment environment,
            String key,
            Class<? extends E> serviceClass); static Map<String, T> loadServices(Configuration configuration, Environment environment, String key, Class<? extends T> serviceClass); }
ServiceProvision { public static <T> Map<String, T> loadServices(Configuration configuration, Environment environment, String key, Class<? extends T> serviceClass) { return configuration.get(key, JsonNode.class) .<Map<String, T>>map(node -> servicesMap(node, environment, serviceClass)) .orElse(emptyMap()); } private  ServiceProvision(); static Optional<E> loadLoadBalancer(
            Configuration configuration,
            Environment environment,
            String key,
            Class<? extends E> serviceClass,
            ActiveOrigins activeOrigins); static Optional<E> loadRetryPolicy(
            Configuration configuration,
            Environment environment,
            String key,
            Class<? extends E> serviceClass); static Map<String, T> loadServices(Configuration configuration, Environment environment, String key, Class<? extends T> serviceClass);  }