use of org.springframework.beans.factory.ObjectProvider in project cas by apereo.
the class CasCoreUtilSerializationConfiguration method componentSerializationPlan.
@ConditionalOnMissingBean(name = "componentSerializationPlan")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public ComponentSerializationPlan componentSerializationPlan(final ObjectProvider<List<ComponentSerializationPlanConfigurer>> configurers) {
val plan = new DefaultComponentSerializationPlan();
plan.registerSerializableClass(TriStateBoolean.class);
configurers.ifAvailable(cfgs -> cfgs.forEach(c -> {
LOGGER.trace("Configuring component serialization plan [{}]", c.getName());
c.configureComponentSerializationPlan(plan);
}));
return plan;
}
use of org.springframework.beans.factory.ObjectProvider in project cas by apereo.
the class CasCoreTicketIdGeneratorsConfiguration method uniqueIdGeneratorsMap.
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public Map<String, UniqueTicketIdGenerator> uniqueIdGeneratorsMap(final ObjectProvider<List<UniqueTicketIdGeneratorConfigurer>> configurers) {
val map = new HashMap<String, UniqueTicketIdGenerator>();
configurers.ifAvailable(cfgs -> cfgs.forEach(c -> {
val pair = c.buildUniqueTicketIdGenerators();
pair.forEach(p -> map.put(p.getKey(), p.getValue()));
}));
return map;
}
use of org.springframework.beans.factory.ObjectProvider in project spring-data-jdbc by spring-projects.
the class JdbcRepositoryFactoryBeanUnitTests method setUp.
@BeforeEach
public void setUp() {
this.mappingContext = new JdbcMappingContext();
// Setup standard configuration
factoryBean = new JdbcRepositoryFactoryBean<>(DummyEntityRepository.class);
when(beanFactory.getBean(NamedParameterJdbcOperations.class)).thenReturn(mock(NamedParameterJdbcOperations.class));
ObjectProvider<DataAccessStrategy> provider = mock(ObjectProvider.class);
when(beanFactory.getBeanProvider(DataAccessStrategy.class)).thenReturn(provider);
when(provider.getIfAvailable(any())).then((Answer<?>) invocation -> ((Supplier<?>) invocation.getArgument(0)).get());
}
Aggregations