當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectProvider類代碼示例

本文整理匯總了Java中org.springframework.beans.factory.ObjectProvider的典型用法代碼示例。如果您正苦於以下問題:Java ObjectProvider類的具體用法?Java ObjectProvider怎麽用?Java ObjectProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ObjectProvider類屬於org.springframework.beans.factory包,在下文中一共展示了ObjectProvider類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: compositeMeterRegistry

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean(MeterRegistry.class)
public CompositeMeterRegistry compositeMeterRegistry(
        MetricsProperties config,
        ObjectProvider<List<MeterRegistryConfigurer>> configurers,
        ObjectProvider<Collection<MetricsExporter>> exportersProvider) {

    CompositeMeterRegistry composite =
            config.isUseGlobalRegistry() ? Metrics.globalRegistry : new CompositeMeterRegistry();

    if (exportersProvider.getIfAvailable() != null) {
        exportersProvider.getIfAvailable().forEach(exporter -> {
            final MeterRegistry childRegistry = exporter.registry();
            if (composite == childRegistry) {
                throw new IllegalStateException("cannot add a CompositeMeterRegistry to itself");
            }
            composite.add(childRegistry);
        });
    }

    if (configurers.getIfAvailable() != null) {
        configurers.getIfAvailable().forEach(conf -> conf.configureRegistry(composite));
    }

    return composite;
}
 
開發者ID:micrometer-metrics,項目名稱:micrometer,代碼行數:27,代碼來源:MetricsAutoConfiguration.java

示例2: CoreConfiguration

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
public CoreConfiguration(OpenIdProviderProperties properties, ObjectProvider<ClientRepository> clientRepository,
		ObjectProvider<JwkSetLoader> jwkSetLoader,
		ObjectProvider<AuthorizationCodeService> authorizationCodeService,
		ObjectProvider<RefreshTokenStore> refreshTokenStore, ObjectProvider<ClaimSource> claimSource,
		ObjectProvider<SubjectResolver> subjectResolver, ObjectProvider<ScopeResolver> scopeResolver,
		ObjectProvider<PasswordAuthenticationHandler> passwordAuthenticationHandler) {
	this.properties = properties;
	this.clientRepository = clientRepository.getObject();
	this.jwkSetLoader = jwkSetLoader.getObject();
	this.authorizationCodeService = authorizationCodeService.getObject();
	this.refreshTokenStore = refreshTokenStore.getObject();
	this.claimSource = claimSource.getObject();
	this.subjectResolver = subjectResolver.getObject();
	this.scopeResolver = scopeResolver.getObject();
	this.passwordAuthenticationHandler = passwordAuthenticationHandler.getObject();
}
 
開發者ID:vpavic,項目名稱:simple-openid-provider,代碼行數:17,代碼來源:CoreConfiguration.java

示例3: defaultKafkaStreamBuilder

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
@Bean(name = KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_BUILDER_BEAN_NAME)
public StreamsBuilderFactoryBean defaultKafkaStreamBuilder(
		@Qualifier(KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME) ObjectProvider<StreamsConfig> streamsConfigProvider) {
	StreamsConfig streamsConfig = streamsConfigProvider.getIfAvailable();
	if (streamsConfig != null) {
		StreamsBuilderFactoryBean kStreamBuilderFactoryBean = new StreamsBuilderFactoryBean(streamsConfig);
		kStreamBuilderFactoryBean.setPhase(Integer.MAX_VALUE - 500);
		return kStreamBuilderFactoryBean;
	}
	else {
		throw new UnsatisfiedDependencyException(KafkaStreamsDefaultConfiguration.class.getName(),
				KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_BUILDER_BEAN_NAME, "streamsConfig",
				"There is no '" + KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME
						+ "' StreamsConfig bean in the application context.\n");
	}
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-stream-binder-kafka,代碼行數:17,代碼來源:KStreamBinderSupportAutoConfiguration.java

示例4: DslContextConfiguration

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
public DslContextConfiguration(JooqProperties properties,
		ConnectionProvider connectionProvider,
		ObjectProvider<TransactionProvider> transactionProviderProvider,
		ObjectProvider<RecordMapperProvider> recordMapperProviderProvider,
		ObjectProvider<Settings> settingsProvider,
		ObjectProvider<RecordListenerProvider[]> recordListenerProvidersProvider,
		ExecuteListenerProvider[] executeListenerProviders,
		ObjectProvider<VisitListenerProvider[]> visitListenerProvidersProvider) {
	this.properties = properties;
	this.connectionProvider = connectionProvider;
	this.transactionProvider = transactionProviderProvider.getIfAvailable();
	this.recordMapperProvider = recordMapperProviderProvider.getIfAvailable();
	this.settings = settingsProvider.getIfAvailable();
	this.recordListenerProviders = recordListenerProvidersProvider
			.getIfAvailable();
	this.executeListenerProviders = executeListenerProviders;
	this.visitListenerProviders = visitListenerProvidersProvider.getIfAvailable();
}
 
開發者ID:philwebb,項目名稱:spring-boot-concourse,代碼行數:19,代碼來源:JooqAutoConfiguration.java

示例5: entityManagerFactoryBuilder

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean
public EntityManagerFactoryBuilder entityManagerFactoryBuilder(
		JpaVendorAdapter jpaVendorAdapter,
		ObjectProvider<PersistenceUnitManager> persistenceUnitManagerProvider) {
	EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilder(
			jpaVendorAdapter, this.properties.getProperties(),
			persistenceUnitManagerProvider.getIfAvailable());
	builder.setCallback(getVendorCallback());
	return builder;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:12,代碼來源:JpaBaseConfiguration.java

示例6: memcachedClient

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
@Bean
public MemcachedClient memcachedClient(ObjectProvider<ConnectionFactory> connection) throws IOException {
    final List<InetSocketAddress> addresses = new ArrayList<>();
    final String servers = environment.getProperty("memcached.servers");
    if (StringUtils.isEmpty(servers)) {
        addresses.add(new InetSocketAddress(LOCALHOST, DEFAULT_PORT));
    } else {
        for (final String server : servers.split(",")) {
            final int colon = server.indexOf(":");
            if (colon == -1) {
                addresses.add(new InetSocketAddress(server, DEFAULT_PORT));
            } else {
                final int port = Integer.parseInt(server.substring(colon + 1));
                addresses.add(new InetSocketAddress(server.substring(0, colon), port));
            }
        }
    }

    ConnectionFactory con = connection.getIfUnique();

    return con == null
            ? new MemcachedClient(addresses)
            : new MemcachedClient(con, addresses);
}
 
開發者ID:bmatthews68,項目名稱:memcached-spring-boot-starter,代碼行數:25,代碼來源:MemcachedAutoConfiguration.java

示例7: resolveDependency

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
@Override
public Object resolveDependency(DependencyDescriptor descriptor, String beanName,
		Set<String> autowiredBeanNames, TypeConverter typeConverter) throws BeansException {

	descriptor.initParameterNameDiscovery(getParameterNameDiscoverer());
	if (descriptor.getDependencyType().equals(javaUtilOptionalClass)) {
		return new OptionalDependencyFactory().createOptionalDependency(descriptor, beanName);
	}
	else if (ObjectFactory.class == descriptor.getDependencyType() ||
			ObjectProvider.class == descriptor.getDependencyType()) {
		return new DependencyObjectProvider(descriptor, beanName);
	}
	else if (javaxInjectProviderClass == descriptor.getDependencyType()) {
		return new Jsr330ProviderFactory().createDependencyProvider(descriptor, beanName);
	}
	else {
		Object result = getAutowireCandidateResolver().getLazyResolutionProxyIfNecessary(descriptor, beanName);
		if (result == null) {
			result = doResolveDependency(descriptor, beanName, autowiredBeanNames, typeConverter); // 解析依賴
		}
		return result;
	}
}
 
開發者ID:txazo,項目名稱:spring,代碼行數:24,代碼來源:DefaultListableBeanFactory.java

示例8: MybatisPlusAutoConfiguration

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
public MybatisPlusAutoConfiguration(MybatisPlusProperties properties,
                                    ObjectProvider<Interceptor[]> interceptorsProvider,
                                    ResourceLoader resourceLoader,
                                    ObjectProvider<DatabaseIdProvider> databaseIdProvider,
                                    ObjectProvider<List<ConfigurationCustomizer>> configurationCustomizersProvider) {
    this.properties = properties;
    this.interceptors = interceptorsProvider.getIfAvailable();
    this.resourceLoader = resourceLoader;
    this.databaseIdProvider = databaseIdProvider.getIfAvailable();
    this.configurationCustomizers = configurationCustomizersProvider.getIfAvailable();
}
 
開發者ID:baomidou,項目名稱:mybatisplus-boot-starter,代碼行數:12,代碼來源:MybatisPlusAutoConfiguration.java

示例9: userInfoRestTemplateFactory

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean
public UserInfoRestTemplateFactory userInfoRestTemplateFactory(
		ObjectProvider<List<UserInfoRestTemplateCustomizer>> customizers,
		ObjectProvider<OAuth2ProtectedResourceDetails> details,
		ObjectProvider<OAuth2ClientContext> oauth2ClientContext) {
	return new DefaultUserInfoRestTemplateFactory(customizers, details,
			oauth2ClientContext);
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:10,代碼來源:ResourceServerTokenServicesConfiguration.java

示例10: SocialTokenServicesConfiguration

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
public SocialTokenServicesConfiguration(ResourceServerProperties sso,
		ObjectProvider<OAuth2ConnectionFactory<?>> connectionFactory,
		UserInfoRestTemplateFactory restTemplateFactory,
		ObjectProvider<AuthoritiesExtractor> authoritiesExtractor,
		ObjectProvider<PrincipalExtractor> principalExtractor) {
	this.sso = sso;
	this.connectionFactory = connectionFactory.getIfAvailable();
	this.restTemplate = restTemplateFactory.getUserInfoRestTemplate();
	this.authoritiesExtractor = authoritiesExtractor.getIfAvailable();
	this.principalExtractor = principalExtractor.getIfAvailable();
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:12,代碼來源:ResourceServerTokenServicesConfiguration.java

示例11: UserInfoTokenServicesConfiguration

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
public UserInfoTokenServicesConfiguration(ResourceServerProperties sso,
		UserInfoRestTemplateFactory restTemplateFactory,
		ObjectProvider<AuthoritiesExtractor> authoritiesExtractor,
		ObjectProvider<PrincipalExtractor> principalExtractor) {
	this.sso = sso;
	this.restTemplate = restTemplateFactory.getUserInfoRestTemplate();
	this.authoritiesExtractor = authoritiesExtractor.getIfAvailable();
	this.principalExtractor = principalExtractor.getIfAvailable();
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:10,代碼來源:ResourceServerTokenServicesConfiguration.java

示例12: JwtTokenServicesConfiguration

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
public JwtTokenServicesConfiguration(ResourceServerProperties resource,
		ObjectProvider<List<JwtAccessTokenConverterConfigurer>> configurers,
		ObjectProvider<List<JwtAccessTokenConverterRestTemplateCustomizer>> customizers) {
	this.resource = resource;
	this.configurers = configurers.getIfAvailable();
	this.customizers = customizers.getIfAvailable();
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:8,代碼來源:ResourceServerTokenServicesConfiguration.java

示例13: DefaultUserInfoRestTemplateFactory

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
public DefaultUserInfoRestTemplateFactory(
		ObjectProvider<List<UserInfoRestTemplateCustomizer>> customizers,
		ObjectProvider<OAuth2ProtectedResourceDetails> details,
		ObjectProvider<OAuth2ClientContext> oauth2ClientContext) {
	this.customizers = customizers.getIfAvailable();
	this.details = details.getIfAvailable();
	this.oauth2ClientContext = oauth2ClientContext.getIfAvailable();
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:9,代碼來源:DefaultUserInfoRestTemplateFactory.java

示例14: OAuth2AuthorizationServerConfiguration

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
public OAuth2AuthorizationServerConfiguration(BaseClientDetails details,
		AuthenticationConfiguration authenticationConfiguration,
		ObjectProvider<TokenStore> tokenStore,
		ObjectProvider<AccessTokenConverter> tokenConverter,
		AuthorizationServerProperties properties) throws Exception {
	this.details = details;
	this.authenticationManager = authenticationConfiguration.getAuthenticationManager();
	this.tokenStore = tokenStore.getIfAvailable();
	this.tokenConverter = tokenConverter.getIfAvailable();
	this.properties = properties;
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:12,代碼來源:OAuth2AuthorizationServerConfiguration.java

示例15: MeterRegistryConfigurationSupport

import org.springframework.beans.factory.ObjectProvider; //導入依賴的package包/類
MeterRegistryConfigurationSupport(MeterRegistry registry,
                                  MetricsProperties config,
                                  ObjectProvider<Collection<MeterBinder>> binders) {
    if (binders.getIfAvailable() != null) {
        binders.getIfAvailable().forEach(binder -> binder.bindTo(registry));
    }

    if (config.isUseGlobalRegistry() && registry != Metrics.globalRegistry) {
        Metrics.addRegistry(registry);
    }
}
 
開發者ID:micrometer-metrics,項目名稱:micrometer,代碼行數:12,代碼來源:MetricsAutoConfiguration.java


注:本文中的org.springframework.beans.factory.ObjectProvider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。