Search in sources :

Example 1 with ResponseStrategy

use of uk.gov.justice.services.adapter.rest.processor.response.ResponseStrategy in project microservice_framework by CJSCommonPlatform.

the class ResponseStrategyCache method strategyFromContext.

private ResponseStrategy strategyFromContext(final String responseStrategyName) {
    final Bean bean = beanManager.getBeans(responseStrategyName).stream().findFirst().orElseThrow(() -> new IllegalArgumentException(format("Response response not found: %s", responseStrategyName)));
    final CreationalContext ctx = beanManager.createCreationalContext(bean);
    return (ResponseStrategy) beanManager.getReference(bean, ResponseStrategy.class, ctx);
}
Also used : CreationalContext(javax.enterprise.context.spi.CreationalContext) ResponseStrategy(uk.gov.justice.services.adapter.rest.processor.response.ResponseStrategy) Bean(javax.enterprise.inject.spi.Bean)

Aggregations

CreationalContext (javax.enterprise.context.spi.CreationalContext)1 Bean (javax.enterprise.inject.spi.Bean)1 ResponseStrategy (uk.gov.justice.services.adapter.rest.processor.response.ResponseStrategy)1