当前位置: 首页>>代码示例>>Java>>正文


Java ConditionalOnBean类代码示例

本文整理汇总了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);
}
 
开发者ID:Xitikit,项目名称:xitikit-blue,代码行数:18,代码来源:B2CServicesAutoConfiguration.java

示例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));
        }
    };
}
 
开发者ID:jkazama,项目名称:sample-boot-hibernate,代码行数:17,代码来源:ApplicationConfig.java

示例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;
}
 
开发者ID:wayshall,项目名称:onetwo,代码行数:24,代码来源:BootSecurityCommonContextConfig.java

示例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;
	}
 
开发者ID:wayshall,项目名称:onetwo,代码行数:22,代码来源:WebAdminPluginContext.java

示例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();
	}
 
开发者ID:shaolinwu,项目名称:uimaster,代码行数:17,代码来源:PersistentConfig.java

示例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);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:8,代码来源:CasReportsConfiguration.java

示例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;
}
 
开发者ID:cereebro,项目名称:cereebro,代码行数:13,代码来源:CereebroEurekaInstanceAutoConfiguration.java

示例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;
}
 
开发者ID:yanghuijava,项目名称:elephant,代码行数:8,代码来源:ActivemqConfig.java

示例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);
}
 
开发者ID:drtrang,项目名称:spring-boot-autoconfigure,代码行数:8,代码来源:MyBatisAutoConfiguration.java

示例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


注:本文中的org.springframework.boot.autoconfigure.condition.ConditionalOnBean类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。