本文整理汇总了Java中org.springframework.boot.autoconfigure.condition.ConditionalOnBean类的典型用法代码示例。如果您正苦于以下问题:Java ConditionalOnBean类的具体用法?Java ConditionalOnBean怎么用?Java ConditionalOnBean使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConditionalOnBean类属于org.springframework.boot.autoconfigure.condition包,在下文中一共展示了ConditionalOnBean类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1:
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Bean("blueKitB2CAuthenticationService")
@Autowired
@ConditionalOnMissingBean(B2CAuthenticationService.class)
@ConditionalOnBean(
value = {B2CProperties.class, SignUpPolicy.class, SignInPolicy.class, SignUpOrSignInPolicy.class, ResetPasswordPolicy.class, EditProfilePolicy.class, SignOutPolicy.class, NonceProperties.class, NonceService.class})
public B2CAuthenticationService blueKitB2CAuthenticationService(
final ClaimValidationService claimValidationService,
final NonceService nonceService,
final UrlService urlService,
final RestTemplate restTemplate){
return new SimpleB2CAuthenticationService(
claimValidationService,
nonceService,
urlService,
restTemplate);
}
示例2: storageConsumer
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@ConditionalOnBean(StorageComponent.class)
@Bean StorageConsumer storageConsumer(
StorageComponent component,
@Value("${zipkin.sparkstreaming.consumer.storage.fail-fast:true}") boolean failFast,
BeanFactory bf
) throws IOException {
if (failFast) checkStorageOk(component);
Properties properties = extractZipkinProperties(bf.getBean(ConfigurableEnvironment.class));
if (component instanceof V2StorageComponent) {
zipkin2.storage.StorageComponent v2Storage = ((V2StorageComponent) component).delegate();
if (v2Storage instanceof ElasticsearchHttpStorage) {
return new ElasticsearchStorageConsumer(properties);
} else if (v2Storage instanceof zipkin2.storage.cassandra.CassandraStorage) {
return new Cassandra3StorageConsumer(properties);
} else {
throw new UnsupportedOperationException(v2Storage + " not yet supported");
}
} else if (component instanceof CassandraStorage) {
return new CassandraStorageConsumer(properties);
} else if (component instanceof MySQLStorage) {
return new MySQLStorageConsumer(properties);
} else {
throw new UnsupportedOperationException(component + " not yet supported");
}
}
开发者ID:openzipkin,项目名称:zipkin-sparkstreaming,代码行数:26,代码来源:ZipkinStorageConsumerAutoConfiguration.java
示例3: dayIndicator
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
/** 営業日チェック */
@Bean
@ConditionalOnBean(BusinessDayHandler.class)
HealthIndicator dayIndicator(final Timestamper time, final BusinessDayHandler day) {
return new AbstractHealthIndicator() {
@Override
protected void doHealthCheck(Builder builder) throws Exception {
builder.up();
builder.withDetail("day", day.day())
.withDetail("dayMinus1", day.day(-1))
.withDetail("dayPlus1", day.day(1))
.withDetail("dayPlus2", day.day(2))
.withDetail("dayPlus3", day.day(3));
}
};
}
示例4: loggerInterceptor
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean({LoggerInterceptor.class})
@ConditionalOnBean(BootSiteConfig.class)
@ConditionalOnProperty(value=AccessLogProperties.ENABLE_MVC_LOGGER_INTERCEPTOR, matchIfMissing=true, havingValue="true")
public LoggerInterceptor loggerInterceptor(){
LoggerInterceptor log = new LoggerInterceptor();
log.setUserDetailRetriever(()->{
if(SecurityContextHolder.getContext().getAuthentication()==null)
return null;
Object user = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if(UserDetail.class.isInstance(user)){
return (UserDetail)user;
}else if(User.class.isInstance(user)){
User suser = (User)user;
SimpleUserDetail ud = new SimpleUserDetail();
ud.setUserName(suser.getUsername());
return ud;
}
return null;
});
log.setPathPatterns(accessLogProperties.getPathPatterns());
return log;
}
示例5: adminPermissionConfigListAdapetor
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Bean
@Autowired
@ConditionalOnBean(RootMenuClassProvider.class)
public AdminPermissionConfigListAdapetor adminPermissionConfigListAdapetor(List<RootMenuClassProvider> providers){
AdminPermissionConfigListAdapetor list = new AdminPermissionConfigListAdapetor();
providers.forEach(provider->{
Collection<Class<?>> rooMenuClassList = new HashSet<>();
if(provider instanceof RootMenuClassListProvider){
rooMenuClassList.addAll(((RootMenuClassListProvider)provider).rootMenuClassList());
}else{
rooMenuClassList.add(provider.rootMenuClass());
}
rooMenuClassList.forEach(rootMenuClass->{
WebAdminPermissionConfig config = new WebAdminPermissionConfig();
// config.setRootMenuClassProvider(provider);
config.setRootMenuClass(rootMenuClass);
list.add(config);
});
});
return list;
}
示例6: entityManagerFactory
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Bean
@ConditionalOnBean(name = "dataSource")
public EntityManagerFactory entityManagerFactory() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(true);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("org.shaolin");
factory.setDataSource(dataSource());
// factory.setPersistenceUnitManager(persistenceUnitManager);
// factory.setMappingResources(mappingResources);
factory.afterPropertiesSet();
return factory.getObject();
}
示例7: socialTokenServices
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Bean
@ConditionalOnBean(ConnectionFactoryLocator.class)
@ConditionalOnMissingBean(ResourceServerTokenServices.class)
public SpringSocialTokenServices socialTokenServices() {
return new SpringSocialTokenServices(this.connectionFactory,
this.sso.getClientId());
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:8,代码来源:ResourceServerTokenServicesConfiguration.java
示例8: internalConfigController
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Profile("standalone")
@ConditionalOnBean(name = "configurationPropertiesEnvironmentManager")
@Bean
@RefreshScope
public MvcEndpoint internalConfigController() {
return new ConfigurationStateController(casProperties);
}
示例9: eurekaMetadataPopulator
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Bean
@ConditionalOnBean(SnitchEndpoint.class)
public EurekaMetadataPopulator eurekaMetadataPopulator(SnitchEndpoint snitch, ApplicationInfoManager manager,
ObjectMapper mapper) {
RelaxedPropertyResolver relaxedPropertyResolver = new RelaxedPropertyResolver(env, "cereebro.snitch.eureka.");
EurekaInstanceSnitchProperties props = new EurekaInstanceSnitchProperties();
props.setEndpointUrl(relaxedPropertyResolver.getProperty("endpointUrl"));
props.setEndpointUrlPath(relaxedPropertyResolver.getProperty("endpointUrlPath"));
EurekaMetadataPopulator metadataPopulator = new EurekaMetadataPopulator(snitch, manager, props, mapper);
metadataPopulator.populate();
return metadataPopulator;
}
示例10: activemqProducerService
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Bean
@ConditionalOnBean(JmsTemplate.class)
public ProducerService activemqProducerService(JmsTemplate jmsTemplate){
ActivemqProducerService activemqProducer = new ActivemqProducerService();
activemqProducer.setJmsTemplate(jmsTemplate);
return activemqProducer;
}
示例11: sqlMapper
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@ConditionalOnBean(SqlSession.class)
@ConditionalOnMissingBean
public SqlMapper sqlMapper(SqlSession sqlSession) {
return new SqlMapper(sqlSession);
}
示例12: createDefaultEntityToCacheMapper
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(EntityToCacheMapper.class)
@ConditionalOnBean(EmbeddedCacheManager.class)
public EntityToCacheMapper createDefaultEntityToCacheMapper(final EmbeddedCacheManager cacheManager) {
return new EntityToCacheMapper() {
public <ID, T> Cache<ID, T> getCache(Class<T> entityClass) {
return cacheManager.getCache(); // always return default cache
}
};
}
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:11,代码来源:SnowdropDataInfinispanEmbeddedAutoConfiguration.java
示例13: createDefaultEntityToCacheMapper
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(EntityToRemoteCacheMapper.class)
@ConditionalOnBean(RemoteCacheManager.class)
public EntityToRemoteCacheMapper createDefaultEntityToCacheMapper(final RemoteCacheManager cacheManager) {
return new EntityToRemoteCacheMapper() {
public <ID, T> RemoteCache<ID, T> getRemoteCache(Class<T> entityClass) {
return cacheManager.getCache(); // always return default cache
}
};
}
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:11,代码来源:SnowdropDataInfinispanRemoteAutoConfiguration.java
示例14: quickfixjServerEndpoint
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Bean
@ConditionalOnBean(name = {"serverAcceptor", "serverSessionSettings"})
@ConditionalOnClass({Acceptor.class, SessionSettings.class})
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint("quickfixjserver")
public QuickFixJServerEndpoint quickfixjServerEndpoint(Acceptor serverAcceptor, SessionSettings serverSessionSettings) {
return new QuickFixJServerEndpoint(serverAcceptor, serverSessionSettings);
}
开发者ID:esanchezros,项目名称:quickfixj-spring-boot-starter,代码行数:9,代码来源:QuickFixJServerEndpointAutoConfiguration.java
示例15: quickfixjClientEndpoint
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; //导入依赖的package包/类
@Bean
@ConditionalOnBean(name = {"clientInitiator", "clientSessionSettings"})
@ConditionalOnClass({Initiator.class, SessionSettings.class})
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint("quickfixjclient")
public QuickFixJClientEndpoint quickfixjClientEndpoint(Initiator clientInitiator, SessionSettings clientSessionSettings) {
return new QuickFixJClientEndpoint(clientInitiator, clientSessionSettings);
}
开发者ID:esanchezros,项目名称:quickfixj-spring-boot-starter,代码行数:9,代码来源:QuickFixJClientEndpointAutoConfiguration.java