當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。