use of org.springframework.beans.factory.annotation.Qualifier in project netxms by netxms.
the class DaoContextConfig method dataSource.
@Bean
@Qualifier("systemDataSource")
public DataSource dataSource() throws PropertyVetoException {
ComboPooledDataSource dataSource = new ComboPooledDataSource();
ServerSettings.DataSourceConfig dataSourceConfig = settings.getDataSourceConfig(ServerSettings.DC_ID_SYSTEM);
dataSource.setDriverClass(dataSourceConfig.getDriver());
dataSource.setJdbcUrl(dataSourceConfig.getUrl());
dataSource.setUser(dataSourceConfig.getUsername());
dataSource.setPassword(dataSourceConfig.getPassword());
dataSource.setTestConnectionOnCheckout(true);
dataSource.setCheckoutTimeout(3000);
dataSource.setIdleConnectionTestPeriod(300);
return dataSource;
}
use of org.springframework.beans.factory.annotation.Qualifier in project cas by apereo.
the class RedisAuthenticationConfiguration method redisPersonAttributeDaos.
@ConditionalOnMissingBean(name = "redisPersonAttributeDaos")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public BeanContainer<IPersonAttributeDao> redisPersonAttributeDaos(final ConfigurableApplicationContext applicationContext, @Qualifier(CasSSLContext.BEAN_NAME) final CasSSLContext casSslContext, final CasConfigurationProperties casProperties) {
return BeanSupplier.of(BeanContainer.class).when(CONDITION.given(applicationContext.getEnvironment())).supply(() -> {
val redis = casProperties.getAuthn().getAttributeRepository().getRedis();
return BeanContainer.of(redis.stream().filter(r -> StringUtils.isNotBlank(r.getHost())).map(r -> {
val conn = RedisObjectFactory.newRedisConnectionFactory(r, true, casSslContext);
val template = RedisObjectFactory.newRedisTemplate(conn);
template.initialize();
val cb = new RedisPersonAttributeDao(template);
cb.setOrder(r.getOrder());
FunctionUtils.doIfNotNull(r.getId(), cb::setId);
return cb;
}).collect(Collectors.toList()));
}).otherwise(BeanContainer::empty).get();
}
use of org.springframework.beans.factory.annotation.Qualifier in project cas by apereo.
the class SamlIdentityProviderDiscoveryConfiguration method samlIdentityProviderEntityParser.
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@ConditionalOnMissingBean(name = "samlIdentityProviderEntityParser")
public Supplier<List<SamlIdentityProviderEntityParser>> samlIdentityProviderEntityParser(final CasConfigurationProperties casProperties, @Qualifier("builtClients") final Clients builtClients) {
val parsers = new ArrayList<SamlIdentityProviderEntityParser>();
val resource = casProperties.getAuthn().getPac4j().getSamlDiscovery().getResource();
resource.stream().filter(res -> res.getLocation() != null).forEach(Unchecked.consumer(res -> parsers.add(new SamlIdentityProviderEntityParser(res.getLocation()))));
builtClients.findAllClients().stream().filter(c -> c instanceof SAML2Client).map(SAML2Client.class::cast).forEach(c -> {
c.init();
val entity = new SamlIdentityProviderEntity();
entity.setEntityID(c.getIdentityProviderResolvedEntityId());
parsers.add(new SamlIdentityProviderEntityParser(entity));
});
return () -> parsers;
}
use of org.springframework.beans.factory.annotation.Qualifier in project uPortal by Jasig.
the class PersonDirectoryConfiguration method getRequestAttributeMergingDao.
/**
* Merges attributes from the request with those from other DAOs.
*/
@Bean(name = "requestAttributeMergingDao")
@Qualifier("uPortalInternal")
public IPersonAttributeDao getRequestAttributeMergingDao() {
final MergingPersonAttributeDaoImpl rslt = new MergingPersonAttributeDaoImpl();
rslt.setUsernameAttributeProvider(getUsernameAttributeProvider());
rslt.setMerger(new ReplacingAttributeAdder());
final List<IPersonAttributeDao> daos = new ArrayList<>();
daos.add(getRequestAttributesDao());
daos.add(getCachingPersonAttributeDao());
rslt.setPersonAttributeDaos(daos);
return rslt;
}
use of org.springframework.beans.factory.annotation.Qualifier in project uPortal by Jasig.
the class PersonDirectoryConfiguration method getCachingPersonAttributeDao.
/**
* Defines the order that the data providing DAOs are called, results are cached by the outer
* caching DAO.
*/
@Bean(name = "cachingPersonAttributeDao")
@Qualifier("uPortalInternal")
public IPersonAttributeDao getCachingPersonAttributeDao() {
final CachingPersonAttributeDaoImpl rslt = new CachingPersonAttributeDaoImpl();
rslt.setUsernameAttributeProvider(getUsernameAttributeProvider());
rslt.setCacheNullResults(true);
rslt.setCacheKeyGenerator(getUserAttributeCacheKeyGenerator());
rslt.setUserInfoCache(new MapCacheProvider<>(userInfoCache));
rslt.setCachedPersonAttributesDao(getMergingPersonAttributeDao());
return rslt;
}
Aggregations