use of org.apereo.cas.services.ServiceRegistryExecutionPlanConfigurer in project cas by apereo.
the class CasCoreServicesConfiguration method serviceRegistry.
@ConditionalOnMissingBean(name = "serviceRegistry")
@Bean
@RefreshScope
public ServiceRegistry serviceRegistry() {
final List<ServiceRegistryExecutionPlanConfigurer> configurers = ObjectUtils.defaultIfNull(serviceRegistryDaoConfigurers.getIfAvailable(), new ArrayList<>(0));
final DefaultServiceRegistryExecutionPlan plan = new DefaultServiceRegistryExecutionPlan();
configurers.forEach(c -> {
final String name = StringUtils.removePattern(c.getClass().getSimpleName(), "\\$.+");
LOGGER.debug("Configuring service registry [{}]", name);
c.configureServiceRegistry(plan);
});
final Predicate filter = Predicates.not(Predicates.instanceOf(ImmutableServiceRegistry.class));
if (plan.getServiceRegistries(filter).isEmpty()) {
final List<RegisteredService> services = new ArrayList<>();
LOGGER.warn("Runtime memory is used as the persistence storage for retrieving and persisting service definitions. " + "Changes that are made to service definitions during runtime WILL be LOST when the web server is restarted. " + "Ideally for production, you need to choose a storage option (JDBC, etc) to store and track service definitions.");
if (applicationContext.containsBean("inMemoryRegisteredServices")) {
services.addAll(applicationContext.getBean("inMemoryRegisteredServices", List.class));
LOGGER.debug("Found a list of registered services in the application context. Registering services [{}]", services);
}
plan.registerServiceRegistry(new InMemoryServiceRegistry(services));
}
return new ChainingServiceRegistry(plan.getServiceRegistries());
}
Aggregations