Search in sources :

Example 1 with ServiceFactory

use of com.hotels.styx.api.configuration.ServiceFactory in project styx by ExpediaGroup.

the class ServiceProvision method loadSpiExtension.

private static <T> T loadSpiExtension(SpiExtension factoryConfig, Environment environment, Class<T> serviceSuperclass) {
    ServiceFactory factory = newServiceFactory(factoryConfig);
    JsonNodeConfig config = new JsonNodeConfig(factoryConfig.config());
    return serviceSuperclass.cast(factory.create(environment, config));
}
Also used : JsonNodeConfig(com.hotels.styx.infrastructure.configuration.yaml.JsonNodeConfig) ServiceFactory(com.hotels.styx.api.configuration.ServiceFactory)

Example 2 with ServiceFactory

use of com.hotels.styx.api.configuration.ServiceFactory in project styx by ExpediaGroup.

the class ServiceProvision method loadServiceFactory.

private static <T> T loadServiceFactory(ServiceFactoryConfig serviceFactoryConfig, Environment environment, Class<T> serviceSuperclass) {
    ServiceFactory factory = newInstance(serviceFactoryConfig.factory(), ServiceFactory.class);
    JsonNodeConfig config = serviceFactoryConfig.config();
    return serviceSuperclass.cast(factory.create(environment, config));
}
Also used : JsonNodeConfig(com.hotels.styx.infrastructure.configuration.yaml.JsonNodeConfig) ServiceFactory(com.hotels.styx.api.configuration.ServiceFactory)

Aggregations

ServiceFactory (com.hotels.styx.api.configuration.ServiceFactory)2 JsonNodeConfig (com.hotels.styx.infrastructure.configuration.yaml.JsonNodeConfig)2