org.springframework.beans.factory.ObjectProvider Java Examples
The following examples show how to use
org.springframework.beans.factory.ObjectProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultListableBeanFactory.java From java-technology-stack with MIT License | 6 votes |
@Override @Nullable public Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName, @Nullable Set<String> autowiredBeanNames, @Nullable TypeConverter typeConverter) throws BeansException { descriptor.initParameterNameDiscovery(getParameterNameDiscoverer()); if (Optional.class == descriptor.getDependencyType()) { return createOptionalDependency(descriptor, requestingBeanName); } else if (ObjectFactory.class == descriptor.getDependencyType() || ObjectProvider.class == descriptor.getDependencyType()) { return new DependencyObjectProvider(descriptor, requestingBeanName); } else if (javaxInjectProviderClass == descriptor.getDependencyType()) { return new Jsr330Factory().createDependencyProvider(descriptor, requestingBeanName); } else { Object result = getAutowireCandidateResolver().getLazyResolutionProxyIfNecessary( descriptor, requestingBeanName); if (result == null) { result = doResolveDependency(descriptor, requestingBeanName, autowiredBeanNames, typeConverter); } return result; } }
Example #2
Source File: KafkaStreamsBinderSupportAutoConfiguration.java From spring-cloud-stream-binder-kafka with Apache License 2.0 | 6 votes |
@Bean public KafkaStreamsStreamListenerSetupMethodOrchestrator kafkaStreamsStreamListenerSetupMethodOrchestrator( BindingServiceProperties bindingServiceProperties, KafkaStreamsExtendedBindingProperties kafkaStreamsExtendedBindingProperties, KeyValueSerdeResolver keyValueSerdeResolver, KafkaStreamsBindingInformationCatalogue kafkaStreamsBindingInformationCatalogue, KStreamStreamListenerParameterAdapter kafkaStreamListenerParameterAdapter, Collection<StreamListenerResultAdapter> streamListenerResultAdapters, ObjectProvider<CleanupConfig> cleanupConfig, ObjectProvider<StreamsBuilderFactoryBeanCustomizer> customizerProvider, ConfigurableEnvironment environment) { return new KafkaStreamsStreamListenerSetupMethodOrchestrator( bindingServiceProperties, kafkaStreamsExtendedBindingProperties, keyValueSerdeResolver, kafkaStreamsBindingInformationCatalogue, kafkaStreamListenerParameterAdapter, streamListenerResultAdapters, cleanupConfig.getIfUnique(), customizerProvider.getIfUnique(), environment); }
Example #3
Source File: BackstopperSpringWebFluxComponentTest.java From backstopper with Apache License 2.0 | 6 votes |
@Bean @Primary public SpringWebfluxUnhandledExceptionHandler springWebfluxUnhandledExceptionHandler( ProjectApiErrors projectApiErrors, ApiExceptionHandlerUtils generalUtils, SpringWebfluxApiExceptionHandlerUtils springUtils, ObjectProvider<ViewResolver> viewResolversProvider, ServerCodecConfigurer serverCodecConfigurer ) { return new SpringWebfluxUnhandledExceptionHandler( projectApiErrors, generalUtils, springUtils, viewResolversProvider, serverCodecConfigurer ) { @Override public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) { exceptionSeenByUnhandledBackstopperHandler = ex; return super.handle(exchange, ex); } }; }
Example #4
Source File: CachingServiceInstanceListSupplierTests.java From spring-cloud-commons with Apache License 2.0 | 6 votes |
@Bean ServiceInstanceListSupplier supplier(ConfigurableApplicationContext context, ReactiveDiscoveryClient discoveryClient, LoadBalancerProperties loadBalancerProperties, WebClient.Builder webClientBuilder) { DiscoveryClientServiceInstanceListSupplier firstDelegate = new DiscoveryClientServiceInstanceListSupplier( discoveryClient, context.getEnvironment()); HealthCheckServiceInstanceListSupplier delegate = new TestHealthCheckServiceInstanceListSupplier( firstDelegate, loadBalancerProperties.getHealthCheck(), webClientBuilder.build()); delegate.afterPropertiesSet(); ObjectProvider<LoadBalancerCacheManager> cacheManagerProvider = context .getBeanProvider(LoadBalancerCacheManager.class); return new CachingServiceInstanceListSupplier(delegate, cacheManagerProvider.getIfAvailable()); }
Example #5
Source File: BeihuMongoDataAutoConfiguration.java From beihu-boot with Apache License 2.0 | 6 votes |
@Bean @ConditionalOnMissingBean(MongoDbFactory.class) public MongoDbFactorySupport<?> mongoDbFactory(ObjectProvider<MongoClient> mongo, ObjectProvider<com.mongodb.client.MongoClient> mongoClient) { MongoClient preferredClient = mongo.getIfAvailable(); if (preferredClient != null) { return new SimpleMongoDbFactory(preferredClient, this.beihuMongoProperties.getMongoClientDatabase()); } com.mongodb.client.MongoClient fallbackClient = mongoClient.getIfAvailable(); if (fallbackClient != null) { return new SimpleMongoClientDbFactory(fallbackClient, this.beihuMongoProperties.getMongoClientDatabase()); } throw new IllegalStateException("Expected to find at least one MongoDB client."); }
Example #6
Source File: BeanFactoryGenericsTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void testGenericMatchingWithUnresolvedOrderedStream() { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); bf.setDependencyComparator(AnnotationAwareOrderComparator.INSTANCE); bf.setAutowireCandidateResolver(new GenericTypeAwareAutowireCandidateResolver()); RootBeanDefinition bd1 = new RootBeanDefinition(NumberStoreFactory.class); bd1.setFactoryMethodName("newDoubleStore"); bf.registerBeanDefinition("store1", bd1); RootBeanDefinition bd2 = new RootBeanDefinition(NumberStoreFactory.class); bd2.setFactoryMethodName("newFloatStore"); bf.registerBeanDefinition("store2", bd2); ObjectProvider<NumberStore<?>> numberStoreProvider = bf.getBeanProvider(ResolvableType.forClass(NumberStore.class)); List<NumberStore<?>> resolved = numberStoreProvider.orderedStream().collect(Collectors.toList()); assertEquals(2, resolved.size()); assertSame(bf.getBean("store2"), resolved.get(0)); assertSame(bf.getBean("store1"), resolved.get(1)); }
Example #7
Source File: RequestProcessor.java From spring-cloud-function with Apache License 2.0 | 5 votes |
public RequestProcessor(FunctionInspector inspector, FunctionCatalog functionCatalog, ObjectProvider<JsonMapper> mapper, StringConverter converter, ObjectProvider<ServerCodecConfigurer> codecs) { this.mapper = mapper.getIfAvailable(); this.inspector = inspector; this.functionCatalog = functionCatalog; this.converter = converter; ServerCodecConfigurer source = codecs.getIfAvailable(); this.messageReaders = source == null ? null : source.getReaders(); }
Example #8
Source File: ContextStackConfiguration.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
public ContextStackConfiguration(ObjectProvider<RegionProvider> regionProvider, ObjectProvider<AWSCredentialsProvider> credentialsProvider, ObjectProvider<AmazonEC2> amazonEc2) { this.regionProvider = regionProvider.getIfAvailable(); this.credentialsProvider = credentialsProvider.getIfAvailable(); this.amazonEc2 = amazonEc2.getIfAvailable(); }
Example #9
Source File: MasterSlaveRuleSpringbootConfiguration.java From shardingsphere with Apache License 2.0 | 5 votes |
/** * Master slave rule configuration for spring boot. * * @param yamlRuleConfiguration YAML master slave rule configuration * @param loadBalanceAlgorithms load balance algorithms * @return master slave rule configuration */ @Bean public RuleConfiguration masterSlaveRuleConfiguration(final YamlMasterSlaveRuleConfiguration yamlRuleConfiguration, final ObjectProvider<Map<String, MasterSlaveLoadBalanceAlgorithm>> loadBalanceAlgorithms) { AlgorithmProvidedMasterSlaveRuleConfiguration ruleConfiguration = swapper.swapToObject(yamlRuleConfiguration); Map<String, MasterSlaveLoadBalanceAlgorithm> balanceAlgorithmMap = Optional.ofNullable(loadBalanceAlgorithms.getIfAvailable()).orElse(Collections.emptyMap()); ruleConfiguration.setLoadBalanceAlgorithms(balanceAlgorithmMap); return ruleConfiguration; }
Example #10
Source File: RedisWebSessionConfiguration.java From spring-session with Apache License 2.0 | 5 votes |
@Autowired public void setRedisConnectionFactory( @SpringSessionRedisConnectionFactory ObjectProvider<ReactiveRedisConnectionFactory> springSessionRedisConnectionFactory, ObjectProvider<ReactiveRedisConnectionFactory> redisConnectionFactory) { ReactiveRedisConnectionFactory redisConnectionFactoryToUse = springSessionRedisConnectionFactory .getIfAvailable(); if (redisConnectionFactoryToUse == null) { redisConnectionFactoryToUse = redisConnectionFactory.getObject(); } this.redisConnectionFactory = redisConnectionFactoryToUse; }
Example #11
Source File: SpringWebfluxUnhandledExceptionHandler.java From backstopper with Apache License 2.0 | 5 votes |
@Inject public SpringWebfluxUnhandledExceptionHandler( @NotNull ProjectApiErrors projectApiErrors, @NotNull ApiExceptionHandlerUtils generalUtils, @NotNull SpringWebfluxApiExceptionHandlerUtils springUtils, @NotNull ObjectProvider<ViewResolver> viewResolversProvider, @NotNull ServerCodecConfigurer serverCodecConfigurer ) { super(projectApiErrors, generalUtils); //noinspection ConstantConditions if (springUtils == null) { throw new NullPointerException("springUtils cannot be null."); } //noinspection ConstantConditions if (viewResolversProvider == null) { throw new NullPointerException("viewResolversProvider cannot be null."); } //noinspection ConstantConditions if (serverCodecConfigurer == null) { throw new NullPointerException("serverCodecConfigurer cannot be null."); } this.singletonGenericServiceError = Collections.singleton(projectApiErrors.getGenericServiceError()); this.genericServiceErrorHttpStatusCode = projectApiErrors.getGenericServiceError().getHttpStatusCode(); this.springUtils = springUtils; this.viewResolvers = viewResolversProvider.orderedStream().collect(Collectors.toList()); this.messageReaders = serverCodecConfigurer.getReaders(); this.messageWriters = serverCodecConfigurer.getWriters(); }
Example #12
Source File: EurekaClientAutoConfiguration.java From spring-cloud-netflix with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnBean(AutoServiceRegistrationProperties.class) @ConditionalOnProperty( value = "spring.cloud.service-registry.auto-registration.enabled", matchIfMissing = true) public EurekaRegistration eurekaRegistration(EurekaClient eurekaClient, CloudEurekaInstanceConfig instanceConfig, ApplicationInfoManager applicationInfoManager, @Autowired( required = false) ObjectProvider<HealthCheckHandler> healthCheckHandler) { return EurekaRegistration.builder(instanceConfig).with(applicationInfoManager) .with(eurekaClient).with(healthCheckHandler).build(); }
Example #13
Source File: VaultEnvironmentRepositoryIntegrationTests.java From spring-cloud-config with Apache License 2.0 | 5 votes |
@Test public void withSslValidation() throws Exception { ObjectProvider<HttpServletRequest> request = withRequest(); VaultEnvironmentRepositoryFactory vaultEnvironmentRepositoryFactory = new VaultEnvironmentRepositoryFactory( request, new EnvironmentWatch.Default(), Optional.of(new HttpClientVaultRestTemplateFactory()), withTokenProvider(request)); VaultEnvironmentRepository vaultEnvironmentRepository = vaultEnvironmentRepositoryFactory .build(withEnvironmentProperties(false)); this.expectedException.expectCause(instanceOf(SSLHandshakeException.class)); vaultEnvironmentRepository.findOne("application", "profile", "label"); }
Example #14
Source File: KotlinProjectGenerationConfiguration.java From initializr with Apache License 2.0 | 5 votes |
@Bean public KotlinProjectSettings kotlinProjectSettings(ObjectProvider<KotlinVersionResolver> kotlinVersionResolver, InitializrMetadata metadata) { String kotlinVersion = kotlinVersionResolver .getIfAvailable(() -> new InitializrMetadataKotlinVersionResolver(metadata)) .resolveKotlinVersion(this.description); return new SimpleKotlinProjectSettings(kotlinVersion, this.description.getLanguage().jvmVersion()); }
Example #15
Source File: DockerPostgresDatabaseProvider.java From embedded-database-spring-test with Apache License 2.0 | 5 votes |
public DockerPostgresDatabaseProvider(Environment environment, ObjectProvider<List<PostgreSQLContainerCustomizer>> containerCustomizers) { String dockerImage = environment.getProperty("zonky.test.database.postgres.docker.image", "postgres:10.11-alpine"); String tmpfsOptions = environment.getProperty("zonky.test.database.postgres.docker.tmpfs.options", "rw,noexec,nosuid"); boolean tmpfsEnabled = environment.getProperty("zonky.test.database.postgres.docker.tmpfs.enabled", boolean.class, false); Map<String, String> initdbProperties = PropertyUtils.extractAll(environment, "zonky.test.database.postgres.initdb.properties"); Map<String, String> configProperties = PropertyUtils.extractAll(environment, "zonky.test.database.postgres.server.properties"); Map<String, String> connectProperties = PropertyUtils.extractAll(environment, "zonky.test.database.postgres.client.properties"); List<PostgreSQLContainerCustomizer> customizers = Optional.ofNullable(containerCustomizers.getIfAvailable()).orElse(emptyList()); this.databaseConfig = new DatabaseConfig(dockerImage, tmpfsOptions, tmpfsEnabled, initdbProperties, configProperties, customizers); this.clientConfig = new ClientConfig(connectProperties); }
Example #16
Source File: RoundRobinLoadBalancer.java From spring-cloud-commons with Apache License 2.0 | 5 votes |
/** * @param serviceInstanceListSupplierProvider a provider of * {@link ServiceInstanceListSupplier} that will be used to get available instances * @param serviceId id of the service for which to choose an instance * @param seedPosition Round Robin element position marker */ public RoundRobinLoadBalancer( ObjectProvider<ServiceInstanceListSupplier> serviceInstanceListSupplierProvider, String serviceId, int seedPosition) { this.serviceId = serviceId; this.serviceInstanceListSupplierProvider = serviceInstanceListSupplierProvider; this.position = new AtomicInteger(seedPosition); }
Example #17
Source File: DmnEngineAutoConfiguration.java From flowable-engine with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean public SpringDmnEngineConfiguration dmnEngineConfiguration(DataSource dataSource, PlatformTransactionManager platformTransactionManager, ObjectProvider<List<AutoDeploymentStrategy<DmnEngine>>> dmnAutoDeploymentStrategies) throws IOException { SpringDmnEngineConfiguration configuration = new SpringDmnEngineConfiguration(); List<Resource> resources = this.discoverDeploymentResources( dmnProperties.getResourceLocation(), dmnProperties.getResourceSuffixes(), dmnProperties.isDeployResources() ); if (resources != null && !resources.isEmpty()) { configuration.setDeploymentResources(resources.toArray(new Resource[0])); configuration.setDeploymentName(dmnProperties.getDeploymentName()); } configureSpringEngine(configuration, platformTransactionManager); configureEngine(configuration, dataSource); configuration.setHistoryEnabled(dmnProperties.isHistoryEnabled()); configuration.setEnableSafeDmnXml(dmnProperties.isEnableSafeXml()); configuration.setStrictMode(dmnProperties.isStrictMode()); // We cannot use orderedStream since we want to support Boot 1.5 which is on pre 5.x Spring List<AutoDeploymentStrategy<DmnEngine>> deploymentStrategies = dmnAutoDeploymentStrategies.getIfAvailable(); if (deploymentStrategies == null) { deploymentStrategies = new ArrayList<>(); } CommonAutoDeploymentProperties deploymentProperties = this.autoDeploymentProperties.deploymentPropertiesForEngine(ScopeTypes.DMN); // Always add the out of the box auto deployment strategies as last deploymentStrategies.add(new DefaultAutoDeploymentStrategy(deploymentProperties)); deploymentStrategies.add(new SingleResourceAutoDeploymentStrategy(deploymentProperties)); deploymentStrategies.add(new ResourceParentFolderAutoDeploymentStrategy(deploymentProperties)); configuration.setDeploymentStrategies(deploymentStrategies); return configuration; }
Example #18
Source File: ErrorHandlerConfiguration.java From soul with Apache License 2.0 | 5 votes |
/** * Instantiates a new Error handler configuration. * * @param serverProperties the server properties * @param resourceProperties the resource properties * @param viewResolversProvider the view resolvers provider * @param serverCodecConfigurer the server codec configurer * @param applicationContext the application context */ public ErrorHandlerConfiguration(final ServerProperties serverProperties, final ResourceProperties resourceProperties, final ObjectProvider<List<ViewResolver>> viewResolversProvider, final ServerCodecConfigurer serverCodecConfigurer, final ApplicationContext applicationContext) { this.serverProperties = serverProperties; this.applicationContext = applicationContext; this.resourceProperties = resourceProperties; this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList); this.serverCodecConfigurer = serverCodecConfigurer; }
Example #19
Source File: ElastiCacheAutoConfiguration.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(AmazonElastiCache.class) public AmazonWebserviceClientFactoryBean<AmazonElastiCacheClient> amazonElastiCache( ObjectProvider<RegionProvider> regionProvider, ObjectProvider<AWSCredentialsProvider> credentialsProvider) { return new AmazonWebserviceClientFactoryBean<>(AmazonElastiCacheClient.class, credentialsProvider.getIfAvailable(), regionProvider.getIfAvailable()); }
Example #20
Source File: DimensionStoreConfiguration.java From sofa-dashboard-client with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean public DimensionRecordingSchedule createStoreSchedule(List<ApplicationDimension> dimensions, ObjectProvider<RecordImporter> storeProvider, SofaDashboardClientProperties props, Environment env) { HostAndPort hostAndPort = getHostAndPort(env, props); RecordImporter importer = storeProvider.getIfAvailable(EmptyRecordImporter::new); return new DimensionRecordingSchedule(hostAndPort, dimensions, importer, props.getStoreInitDelayExp(), props.getStoreUploadPeriodExp()); }
Example #21
Source File: PrefetchingDatabaseProvider.java From embedded-database-spring-test with Apache License 2.0 | 5 votes |
public PrefetchingDatabaseProvider(ObjectProvider<List<DatabaseProvider>> databaseProviders, Environment environment) { this.databaseProviders = Optional.ofNullable(databaseProviders.getIfAvailable()).orElse(emptyList()).stream() .collect(Collectors.toMap(p -> new DatabaseDescriptor(p.getDatabaseType(), p.getProviderType()), identity())); String threadNamePrefix = environment.getProperty("zonky.test.database.prefetching.thread-name-prefix", "prefetching-"); int concurrency = environment.getProperty("zonky.test.database.prefetching.concurrency", int.class, 3); pipelineCacheSize = environment.getProperty("zonky.test.database.prefetching.pipeline-cache-size", int.class, 3); taskExecutor.setThreadNamePrefix(threadNamePrefix); taskExecutor.setCorePoolSize(concurrency); }
Example #22
Source File: RestTemplateAutoConfiguration.java From summerframework with Apache License 2.0 | 5 votes |
@Bean public SmartInitializingSingleton metricsAsyncRestTemplateInitializer( final ObjectProvider<List<AsyncRestTemplate>> asyncRestTemplatesProvider, final RestTemplatePostProcessor customizer) { return () -> { final List<AsyncRestTemplate> asyncRestTemplates = asyncRestTemplatesProvider.getIfAvailable(); if (!CollectionUtils.isEmpty(asyncRestTemplates)) { asyncRestTemplates.forEach(customizer::customize); } }; }
Example #23
Source File: GatewayExceptionConfig.java From spring-microservice-exam with MIT License | 5 votes |
/** * 自定义异常处理 */ @Primary @Bean @Order(Ordered.HIGHEST_PRECEDENCE) public ErrorWebExceptionHandler errorWebExceptionHandler(ObjectProvider<List<ViewResolver>> viewResolversProvider, ServerCodecConfigurer serverCodecConfigurer) { GatewayExceptionHandler gatewayExceptionHandler = new GatewayExceptionHandler(); gatewayExceptionHandler.setViewResolvers(viewResolversProvider.getIfAvailable(Collections::emptyList)); gatewayExceptionHandler.setMessageWriters(serverCodecConfigurer.getWriters()); gatewayExceptionHandler.setMessageReaders(serverCodecConfigurer.getReaders()); return gatewayExceptionHandler; }
Example #24
Source File: MultRegisterCenterServerMgmtConfig.java From Moss with Apache License 2.0 | 5 votes |
public EurekaRegistration eurekaRegistration(EurekaClient eurekaClient, CloudEurekaInstanceConfig instanceConfig, ApplicationInfoManager applicationInfoManager, @Autowired(required = false) ObjectProvider<HealthCheckHandler> healthCheckHandler) { return EurekaRegistration.builder(instanceConfig) .with(applicationInfoManager) .with(eurekaClient) .with(healthCheckHandler) .build(); }
Example #25
Source File: RedissonSpringAutoConfiguration.java From redisson-spring-boot with Apache License 2.0 | 5 votes |
public RedissonSpringAutoConfiguration(RedissonSpringProperties redissonSpringProperties, ObjectProvider<List<Customizer<RedissonSpringCacheManager>>> customizersProvider) { this.redissonSpringProperties = redissonSpringProperties; this.redissonSpringCacheManagerCustomizers = customizersProvider.getIfAvailable(); this.redissonSpringCacheManagerCustomizers = redissonSpringCacheManagerCustomizers != null ? redissonSpringCacheManagerCustomizers : emptyList(); }
Example #26
Source File: InitializrAutoConfiguration.java From initializr with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(InitializrMetadataProvider.class) public InitializrMetadataProvider initializrMetadataProvider(InitializrProperties properties, ObjectProvider<InitializrMetadataUpdateStrategy> initializrMetadataUpdateStrategy) { InitializrMetadata metadata = InitializrMetadataBuilder.fromInitializrProperties(properties).build(); return new DefaultInitializrMetadataProvider(metadata, initializrMetadataUpdateStrategy.getIfAvailable(() -> (current) -> current)); }
Example #27
Source File: SpringBootAdminClientCloudFoundryAutoConfiguration.java From spring-boot-admin with Apache License 2.0 | 5 votes |
@Bean @Lazy(false) @ConditionalOnMissingBean public CloudFoundryApplicationFactory applicationFactory(InstanceProperties instance, ManagementServerProperties management, ServerProperties server, PathMappedEndpoints pathMappedEndpoints, WebEndpointProperties webEndpoint, ObjectProvider<List<MetadataContributor>> metadataContributors, CloudFoundryApplicationProperties cfApplicationProperties) { return new CloudFoundryApplicationFactory(instance, management, server, pathMappedEndpoints, webEndpoint, new CompositeMetadataContributor(metadataContributors.getIfAvailable(Collections::emptyList)), cfApplicationProperties); }
Example #28
Source File: SpringWebfluxApiExceptionHandler.java From backstopper with Apache License 2.0 | 5 votes |
@Inject public SpringWebfluxApiExceptionHandler( @NotNull ProjectApiErrors projectApiErrors, @NotNull SpringWebFluxApiExceptionHandlerListenerList apiExceptionHandlerListeners, @NotNull ApiExceptionHandlerUtils generalUtils, @NotNull SpringWebfluxApiExceptionHandlerUtils springUtils, @NotNull ObjectProvider<ViewResolver> viewResolversProvider, @NotNull ServerCodecConfigurer serverCodecConfigurer ) { super(projectApiErrors, apiExceptionHandlerListeners.listeners, generalUtils); //noinspection ConstantConditions if (springUtils == null) { throw new NullPointerException("springUtils cannot be null."); } //noinspection ConstantConditions if (viewResolversProvider == null) { throw new NullPointerException("viewResolversProvider cannot be null."); } //noinspection ConstantConditions if (serverCodecConfigurer == null) { throw new NullPointerException("serverCodecConfigurer cannot be null."); } this.springUtils = springUtils; this.viewResolvers = viewResolversProvider.orderedStream().collect(Collectors.toList()); this.messageReaders = serverCodecConfigurer.getReaders(); this.messageWriters = serverCodecConfigurer.getWriters(); }
Example #29
Source File: JobQuartzAutoConfiguration.java From spring-boot-starter-micro-job with Apache License 2.0 | 5 votes |
@Bean @Order(0) public SchedulerFactoryBeanCustomizer jobDataSourceCustomizer(QuartzProperties properties, DataSource dataSource, @QuartzDataSource ObjectProvider<DataSource> quartzDataSource, ObjectProvider<PlatformTransactionManager> transactionManager) { return (schedulerFactoryBean) -> { if (properties.getJobStoreType() == JobStoreType.JDBC) { DataSource dataSourceToUse = this.getDataSource(dataSource, quartzDataSource); schedulerFactoryBean.setDataSource(dataSourceToUse); PlatformTransactionManager txManager = (PlatformTransactionManager) transactionManager.getIfUnique(); if (txManager != null) { schedulerFactoryBean.setTransactionManager(txManager); } } }; }
Example #30
Source File: HttpClientPluginConfiguration.java From soul with Apache License 2.0 | 5 votes |
/** * Web client plugin soul plugin. * * @param httpClient the http client * @return the soul plugin */ @Bean public SoulPlugin webClientPlugin(final ObjectProvider<HttpClient> httpClient) { WebClient webClient = WebClient.builder() .clientConnector(new ReactorClientHttpConnector(Objects.requireNonNull(httpClient.getIfAvailable()))) .build(); return new WebClientPlugin(webClient); }