use of org.springframework.beans.factory.annotation.Qualifier in project zipkin by openzipkin.
the class ZipkinElasticsearchStorageConfiguration method esTracing.
@Bean
@Qualifier(QUALIFIER)
@ConditionalOnSelfTracing
Consumer<ClientOptionsBuilder> esTracing(Optional<HttpTracing> maybeHttpTracing) {
if (!maybeHttpTracing.isPresent()) {
// Alternatively, check why we would ever get here if ConditionalOnSelfTracing matches
return client -> {
};
}
HttpTracing httpTracing = maybeHttpTracing.get().clientOf("elasticsearch");
SpanCustomizer spanCustomizer = CurrentSpanCustomizer.create(httpTracing.tracing());
return client -> {
client.decorator((delegate, ctx, req) -> {
// We only need the name if it's available and can unsafely access the partially filled log.
RequestLog log = ctx.log().partial();
if (log.isAvailable(RequestLogProperty.NAME)) {
String name = log.name();
if (name != null) {
// override the span name if set
spanCustomizer.name(name);
}
}
return delegate.execute(ctx, req);
});
// the tracing decorator is added last so that it encloses the attempt to overwrite the name.
client.decorator(BraveClient.newDecorator(httpTracing));
};
}
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