@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; }
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(); }
@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"); } }
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(); }
@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; }
@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); }
@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; } }
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(); }
@Bean @ConditionalOnMissingBean public UserInfoRestTemplateFactory userInfoRestTemplateFactory( ObjectProvider<List<UserInfoRestTemplateCustomizer>> customizers, ObjectProvider<OAuth2ProtectedResourceDetails> details, ObjectProvider<OAuth2ClientContext> oauth2ClientContext) { return new DefaultUserInfoRestTemplateFactory(customizers, details, oauth2ClientContext); }
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(); }
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(); }
public JwtTokenServicesConfiguration(ResourceServerProperties resource, ObjectProvider<List<JwtAccessTokenConverterConfigurer>> configurers, ObjectProvider<List<JwtAccessTokenConverterRestTemplateCustomizer>> customizers) { this.resource = resource; this.configurers = configurers.getIfAvailable(); this.customizers = customizers.getIfAvailable(); }
public DefaultUserInfoRestTemplateFactory( ObjectProvider<List<UserInfoRestTemplateCustomizer>> customizers, ObjectProvider<OAuth2ProtectedResourceDetails> details, ObjectProvider<OAuth2ClientContext> oauth2ClientContext) { this.customizers = customizers.getIfAvailable(); this.details = details.getIfAvailable(); this.oauth2ClientContext = oauth2ClientContext.getIfAvailable(); }
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; }
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); } }
public DocumentDBAutoConfiguration(DocumentDBProperties properties, ObjectProvider<ConnectionPolicy> connectionPolicyObjectProvider, ApplicationContext applicationContext) { this.properties = properties; this.connectionPolicy = connectionPolicyObjectProvider.getIfAvailable(); this.applicationContext = applicationContext; }
public OAuth2Configuration(ResourceLoader resourceLoader, OpenIdProviderProperties properties, ObjectProvider<JdbcOperations> jdbcOperations, ObjectProvider<AuthenticationManager> authenticationManager, ObjectProvider<HazelcastInstance> hazelcastInstance) { this.resourceLoader = resourceLoader; this.properties = properties; this.jdbcOperations = jdbcOperations.getObject(); this.authenticationManager = authenticationManager.getObject(); this.hazelcastInstance = hazelcastInstance.getObject(); }
public MyBatisMigrationsConfiguration(MyBatisMigrationsProperties properties, ObjectProvider<DataSource> dataSource, @MyBatisMigrationsDataSource ObjectProvider<DataSource> myBatisMigrationsDataSource, ResourcePatternResolver resourceResolver) { this.properties = properties; this.resourceResolver = resourceResolver; this.dataSource = dataSource.getIfUnique(); this.myBatisMigrationsDataSource = myBatisMigrationsDataSource.getIfAvailable(); }
public MapperAutoConfiguration(MybatisProperties 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(); }
@Bean @Primary public TestRestTemplate zg2TestRestTemplate(ObjectProvider<RestTemplateBuilder> builderProvider, Environment environment) { SimpleModule sm = new SimpleModule(); Zg2proRestTemplate rt = new Zg2proRestTemplate(sm); TestRestTemplate trt = new TestRestTemplate(rt); trt.setUriTemplateHandler(new LocalHostUriTemplateHandler(environment)); return trt; }
@Bean @ConditionalOnMissingBean(MockMvcRestDocumentationConfigurer.class) public MockMvcRestDocumentationConfigurer restDocsMockMvcConfigurer( ObjectProvider<RestDocsMockMvcConfigurationCustomizer> configurationCustomizerProvider, RestDocumentationContextProvider contextProvider) { MockMvcRestDocumentationConfigurer configurer = MockMvcRestDocumentation .documentationConfiguration(contextProvider); RestDocsMockMvcConfigurationCustomizer configurationCustomizer = configurationCustomizerProvider .getIfAvailable(); if (configurationCustomizer != null) { configurationCustomizer.customize(configurer); } return configurer; }
@Bean @ConfigurationProperties("spring.test.restdocs") public RestDocsMockMvcBuilderCustomizer restDocumentationConfigurer( MockMvcRestDocumentationConfigurer configurer, ObjectProvider<RestDocumentationResultHandler> resultHandler) { return new RestDocsMockMvcBuilderCustomizer(configurer, resultHandler.getIfAvailable()); }
public ManagementWebSecurityConfigurerAdapter(SecurityProperties security, ManagementServerProperties management, ObjectProvider<ManagementContextResolver> contextResolverProvider) { this.security = security; this.management = management; this.contextResolver = contextResolverProvider.getIfAvailable(); }
public JmsTemplateConfiguration(JmsProperties properties, ObjectProvider<DestinationResolver> destinationResolver, ObjectProvider<MessageConverter> messageConverter) { this.properties = properties; this.destinationResolver = destinationResolver; this.messageConverter = messageConverter; }
public TraceWebFilterAutoConfiguration(TraceRepository traceRepository, TraceProperties traceProperties, ObjectProvider<ErrorAttributes> errorAttributesProvider) { this.traceRepository = traceRepository; this.traceProperties = traceProperties; this.errorAttributes = errorAttributesProvider.getIfAvailable(); }
public MetricExportAutoConfiguration(MetricExportProperties properties, ObjectProvider<MetricsEndpointMetricReader> endpointReaderProvider, @ExportMetricReader ObjectProvider<List<MetricReader>> readersProvider, @ExportMetricWriter ObjectProvider<Map<String, GaugeWriter>> writersProvider, ObjectProvider<Map<String, Exporter>> exportersProvider) { this.properties = properties; this.endpointReader = endpointReaderProvider.getIfAvailable(); this.readers = readersProvider.getIfAvailable(); this.writers = writersProvider.getIfAvailable(); this.exporters = exportersProvider.getIfAvailable(); }
public GroovyMarkupConfiguration(ApplicationContext applicationContext, GroovyTemplateProperties properties, ObjectProvider<MarkupTemplateEngine> templateEngineProvider) { this.applicationContext = applicationContext; this.properties = properties; this.templateEngine = templateEngineProvider.getIfAvailable(); }
public EndpointAutoConfiguration( ObjectProvider<HealthAggregator> healthAggregatorProvider, ObjectProvider<Map<String, HealthIndicator>> healthIndicatorsProvider, ObjectProvider<List<InfoContributor>> infoContributorsProvider, ObjectProvider<Collection<PublicMetrics>> publicMetricsProvider, ObjectProvider<TraceRepository> traceRepositoryProvider) { this.healthAggregator = healthAggregatorProvider.getIfAvailable(); this.healthIndicators = healthIndicatorsProvider.getIfAvailable(); this.infoContributors = infoContributorsProvider.getIfAvailable(); this.publicMetrics = publicMetricsProvider.getIfAvailable(); this.traceRepository = traceRepositoryProvider.getIfAvailable(); }
public DispatcherServletRegistrationConfiguration( ServerProperties serverProperties, WebMvcProperties webMvcProperties, ObjectProvider<MultipartConfigElement> multipartConfigProvider) { this.serverProperties = serverProperties; this.webMvcProperties = webMvcProperties; this.multipartConfig = multipartConfigProvider.getIfAvailable(); }
public WebMvcAutoConfigurationAdapter(ResourceProperties resourceProperties, WebMvcProperties mvcProperties, ListableBeanFactory beanFactory, HttpMessageConverters messageConverters, ObjectProvider<ResourceHandlerRegistrationCustomizer> resourceHandlerRegistrationCustomizerProvider) { this.resourceProperties = resourceProperties; this.mvcProperties = mvcProperties; this.beanFactory = beanFactory; this.messageConverters = messageConverters; this.resourceHandlerRegistrationCustomizer = resourceHandlerRegistrationCustomizerProvider .getIfAvailable(); }
public EnableWebMvcConfiguration( ObjectProvider<WebMvcProperties> mvcPropertiesProvider, ObjectProvider<WebMvcRegistrations> mvcRegistrationsProvider, ListableBeanFactory beanFactory) { this.mvcProperties = mvcPropertiesProvider.getIfAvailable(); this.mvcRegistrations = mvcRegistrationsProvider.getIfUnique(); this.beanFactory = beanFactory; }
@Bean @ConditionalOnMissingBean public UserInfoRestTemplateFactory userInfoRestTemplateFactory( ObjectProvider<List<UserInfoRestTemplateCustomizer>> customizersProvider, ObjectProvider<OAuth2ProtectedResourceDetails> detailsProvider, ObjectProvider<OAuth2ClientContext> oauth2ClientContextProvider) { return new UserInfoRestTemplateFactory(customizersProvider, detailsProvider, oauth2ClientContextProvider); }
public SocialTokenServicesConfiguration(ResourceServerProperties sso, ObjectProvider<OAuth2ConnectionFactory<?>> connectionFactoryProvider, UserInfoRestTemplateFactory restTemplateFactory, ObjectProvider<AuthoritiesExtractor> authoritiesExtractor, ObjectProvider<PrincipalExtractor> principalExtractor) { this.sso = sso; this.connectionFactory = connectionFactoryProvider.getIfAvailable(); this.restTemplate = restTemplateFactory.getUserInfoRestTemplate(); this.authoritiesExtractor = authoritiesExtractor.getIfAvailable(); this.principalExtractor = principalExtractor.getIfAvailable(); }
public FlywayConfiguration(FlywayProperties properties, ResourceLoader resourceLoader, ObjectProvider<DataSource> dataSourceProvider, @FlywayDataSource ObjectProvider<DataSource> flywayDataSourceProvider, ObjectProvider<FlywayMigrationStrategy> migrationStrategyProvider) { this.properties = properties; this.resourceLoader = resourceLoader; this.dataSource = dataSourceProvider.getIfUnique(); this.flywayDataSource = flywayDataSourceProvider.getIfAvailable(); this.migrationStrategy = migrationStrategyProvider.getIfAvailable(); }
public OAuth2AuthorizationServerConfiguration(BaseClientDetails details, AuthenticationManager authenticationManager, ObjectProvider<TokenStore> tokenStoreProvider, AuthorizationServerProperties properties) { this.details = details; this.authenticationManager = authenticationManager; this.tokenStore = tokenStoreProvider.getIfAvailable(); this.properties = properties; }
HornetQEmbeddedServerConfiguration(HornetQProperties properties, ObjectProvider<List<HornetQConfigurationCustomizer>> configurationCustomizersProvider, ObjectProvider<List<JMSQueueConfiguration>> queuesConfigurationProvider, ObjectProvider<List<TopicConfiguration>> topicsConfigurationProvider) { this.properties = properties; this.configurationCustomizers = configurationCustomizersProvider.getIfAvailable(); this.queuesConfiguration = queuesConfigurationProvider.getIfAvailable(); this.topicsConfiguration = topicsConfigurationProvider.getIfAvailable(); }
public RedisConnectionConfiguration(RedisProperties properties, ObjectProvider<RedisSentinelConfiguration> sentinelConfigurationProvider, ObjectProvider<RedisClusterConfiguration> clusterConfigurationProvider) { this.properties = properties; this.sentinelConfiguration = sentinelConfigurationProvider.getIfAvailable(); this.clusterConfiguration = clusterConfigurationProvider.getIfAvailable(); }