Merge branch '2.7.x' into 3.0.x

This commit is contained in:
Phillip Webb
2023-02-21 23:15:40 -08:00
1890 changed files with 27173 additions and 21952 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,8 +79,8 @@ public abstract class AbstractDependsOnBeanFactoryPostProcessor implements BeanF
this.beanClass = beanClass;
this.factoryBeanClass = factoryBeanClass;
this.dependsOn = (beanFactory) -> Arrays.stream(dependencyTypes)
.flatMap((dependencyType) -> getBeanNames(beanFactory, dependencyType).stream())
.collect(Collectors.toSet());
.flatMap((dependencyType) -> getBeanNames(beanFactory, dependencyType).stream())
.collect(Collectors.toSet());
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ public class AutoConfigurationExcludeFilter implements TypeFilter, BeanClassLoad
private boolean isAutoConfiguration(MetadataReader metadataReader) {
boolean annotatedWithAutoConfiguration = metadataReader.getAnnotationMetadata()
.isAnnotated(AutoConfiguration.class.getName());
.isAnnotated(AutoConfiguration.class.getName());
return annotatedWithAutoConfiguration
|| getAutoConfigurations().contains(metadataReader.getClassMetadata().getClassName());
}
@@ -64,7 +64,7 @@ public class AutoConfigurationExcludeFilter implements TypeFilter, BeanClassLoad
protected List<String> getAutoConfigurations() {
if (this.autoConfigurations == null) {
this.autoConfigurations = ImportCandidates.load(AutoConfiguration.class, this.beanClassLoader)
.getCandidates();
.getCandidates();
}
return this.autoConfigurations;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -178,7 +178,7 @@ public class AutoConfigurationImportSelector implements DeferredImportSelector,
*/
protected List<String> getCandidateConfigurations(AnnotationMetadata metadata, AnnotationAttributes attributes) {
List<String> configurations = ImportCandidates.load(AutoConfiguration.class, getBeanClassLoader())
.getCandidates();
.getCandidates();
Assert.notEmpty(configurations,
"No auto configuration classes found in "
+ "META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports. If you "
@@ -241,8 +241,9 @@ public class AutoConfigurationImportSelector implements DeferredImportSelector,
}
if (environment instanceof ConfigurableEnvironment) {
Binder binder = Binder.get(environment);
return binder.bind(PROPERTY_NAME_AUTOCONFIGURE_EXCLUDE, String[].class).map(Arrays::asList)
.orElse(Collections.emptyList());
return binder.bind(PROPERTY_NAME_AUTOCONFIGURE_EXCLUDE, String[].class)
.map(Arrays::asList)
.orElse(Collections.emptyList());
}
String[] excludes = environment.getProperty(PROPERTY_NAME_AUTOCONFIGURE_EXCLUDE, String[].class);
return (excludes != null) ? Arrays.asList(excludes) : Collections.emptyList();
@@ -426,7 +427,7 @@ public class AutoConfigurationImportSelector implements DeferredImportSelector,
AutoConfigurationImportSelector.class.getSimpleName(),
deferredImportSelector.getClass().getName()));
AutoConfigurationEntry autoConfigurationEntry = ((AutoConfigurationImportSelector) deferredImportSelector)
.getAutoConfigurationEntry(annotationMetadata);
.getAutoConfigurationEntry(annotationMetadata);
this.autoConfigurationEntries.add(autoConfigurationEntry);
for (String importClassName : autoConfigurationEntry.getConfigurations()) {
this.entries.putIfAbsent(importClassName, annotationMetadata);
@@ -439,14 +440,18 @@ public class AutoConfigurationImportSelector implements DeferredImportSelector,
return Collections.emptyList();
}
Set<String> allExclusions = this.autoConfigurationEntries.stream()
.map(AutoConfigurationEntry::getExclusions).flatMap(Collection::stream).collect(Collectors.toSet());
.map(AutoConfigurationEntry::getExclusions)
.flatMap(Collection::stream)
.collect(Collectors.toSet());
Set<String> processedConfigurations = this.autoConfigurationEntries.stream()
.map(AutoConfigurationEntry::getConfigurations).flatMap(Collection::stream)
.collect(Collectors.toCollection(LinkedHashSet::new));
.map(AutoConfigurationEntry::getConfigurations)
.flatMap(Collection::stream)
.collect(Collectors.toCollection(LinkedHashSet::new));
processedConfigurations.removeAll(allExclusions);
return sortAutoConfigurations(processedConfigurations, getAutoConfigurationMetadata()).stream()
.map((importClassName) -> new Entry(this.entries.get(importClassName), importClassName)).toList();
.map((importClassName) -> new Entry(this.entries.get(importClassName), importClassName))
.toList();
}
private AutoConfigurationMetadata getAutoConfigurationMetadata() {
@@ -459,7 +464,7 @@ public class AutoConfigurationImportSelector implements DeferredImportSelector,
private List<String> sortAutoConfigurations(Set<String> configurations,
AutoConfigurationMetadata autoConfigurationMetadata) {
return new AutoConfigurationSorter(getMetadataReaderFactory(), autoConfigurationMetadata)
.getInPriorityOrder(configurations);
.getInPriorityOrder(configurations);
}
private MetadataReaderFactory getMetadataReaderFactory() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -106,10 +106,11 @@ public abstract class AutoConfigurationPackages {
ConstructorArgumentValues constructorArgumentValues = beanDefinition.getConstructorArgumentValues();
if (constructorArgumentValues.hasIndexedArgumentValue(0)) {
String[] existingPackages = (String[]) constructorArgumentValues.getIndexedArgumentValue(0, String[].class)
.getValue();
.getValue();
constructorArgumentValues.addIndexedArgumentValue(0,
Stream.concat(Stream.of(existingPackages), Stream.of(additionalBasePackages)).distinct()
.toArray(String[]::new));
Stream.concat(Stream.of(existingPackages), Stream.of(additionalBasePackages))
.distinct()
.toArray(String[]::new));
}
else {
constructorArgumentValues.addIndexedArgumentValue(0, additionalBasePackages);
@@ -143,7 +144,7 @@ public abstract class AutoConfigurationPackages {
PackageImports(AnnotationMetadata metadata) {
AnnotationAttributes attributes = AnnotationAttributes
.fromMap(metadata.getAnnotationAttributes(AutoConfigurationPackage.class.getName(), false));
.fromMap(metadata.getAnnotationAttributes(AutoConfigurationPackage.class.getName(), false));
List<String> packageNames = new ArrayList<>(Arrays.asList(attributes.getStringArray("basePackages")));
for (Class<?> basePackageClass : attributes.getClassArray("basePackageClasses")) {
packageNames.add(basePackageClass.getPackage().getName());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -206,7 +206,7 @@ class AutoConfigurationSorter {
AutoConfigureOrder.DEFAULT_ORDER);
}
Map<String, Object> attributes = getAnnotationMetadata()
.getAnnotationAttributes(AutoConfigureOrder.class.getName());
.getAnnotationAttributes(AutoConfigureOrder.class.getName());
return (attributes != null) ? (Integer) attributes.get("value") : AutoConfigureOrder.DEFAULT_ORDER;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,8 +49,9 @@ public class AutoConfigurations extends Configurations implements Ordered {
protected Collection<Class<?>> sort(Collection<Class<?>> classes) {
List<String> names = classes.stream().map(Class::getName).toList();
List<String> sorted = SORTER.getInPriorityOrder(names);
return sorted.stream().map((className) -> ClassUtils.resolveClassName(className, null))
.collect(Collectors.toCollection(ArrayList::new));
return sorted.stream()
.map((className) -> ClassUtils.resolveClassName(className, null))
.collect(Collectors.toCollection(ArrayList::new));
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -112,8 +112,8 @@ class SharedMetadataReaderFactoryContextInitializer implements
private void register(BeanDefinitionRegistry registry) {
if (!registry.containsBeanDefinition(BEAN_NAME)) {
BeanDefinition definition = BeanDefinitionBuilder
.rootBeanDefinition(SharedMetadataReaderFactoryBean.class, SharedMetadataReaderFactoryBean::new)
.getBeanDefinition();
.rootBeanDefinition(SharedMetadataReaderFactoryBean.class, SharedMetadataReaderFactoryBean::new)
.getBeanDefinition();
registry.registerBeanDefinition(BEAN_NAME, definition);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,8 +56,9 @@ public abstract class AbstractConnectionFactoryConfigurer<T extends AbstractConn
Assert.notNull(connectionFactory, "ConnectionFactory must not be null");
PropertyMapper map = PropertyMapper.get();
map.from(this.rabbitProperties::determineAddresses).to(connectionFactory::setAddresses);
map.from(this.rabbitProperties::getAddressShuffleMode).whenNonNull()
.to(connectionFactory::setAddressShuffleMode);
map.from(this.rabbitProperties::getAddressShuffleMode)
.whenNonNull()
.to(connectionFactory::setAddressShuffleMode);
map.from(this.connectionNameStrategy).whenNonNull().to(connectionFactory::setConnectionNameStrategy);
configure(connectionFactory, this.rabbitProperties);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -123,7 +123,7 @@ public abstract class AbstractRabbitListenerContainerFactoryConfigurer<T extends
RetryInterceptorBuilder<?, ?> builder = (retryConfig.isStateless()) ? RetryInterceptorBuilder.stateless()
: RetryInterceptorBuilder.stateful();
RetryTemplate retryTemplate = new RetryTemplateFactory(this.retryTemplateCustomizers)
.createRetryTemplate(retryConfig, RabbitRetryTemplateCustomizer.Target.LISTENER);
.createRetryTemplate(retryConfig, RabbitRetryTemplateCustomizer.Target.LISTENER);
builder.retryOperations(retryTemplate);
MessageRecoverer recoverer = (this.messageRecoverer != null) ? this.messageRecoverer
: new RejectAndDontRequeueRecoverer();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,12 +37,15 @@ public class CachingConnectionFactoryConfigurer extends AbstractConnectionFactor
public void configure(CachingConnectionFactory connectionFactory, RabbitProperties rabbitProperties) {
PropertyMapper map = PropertyMapper.get();
map.from(rabbitProperties::isPublisherReturns).to(connectionFactory::setPublisherReturns);
map.from(rabbitProperties::getPublisherConfirmType).whenNonNull()
.to(connectionFactory::setPublisherConfirmType);
map.from(rabbitProperties::getPublisherConfirmType)
.whenNonNull()
.to(connectionFactory::setPublisherConfirmType);
RabbitProperties.Cache.Channel channel = rabbitProperties.getCache().getChannel();
map.from(channel::getSize).whenNonNull().to(connectionFactory::setChannelCacheSize);
map.from(channel::getCheckoutTimeout).whenNonNull().as(Duration::toMillis)
.to(connectionFactory::setChannelCheckoutTimeout);
map.from(channel::getCheckoutTimeout)
.whenNonNull()
.as(Duration::toMillis)
.to(connectionFactory::setChannelCheckoutTimeout);
RabbitProperties.Cache.Connection connection = rabbitProperties.getCache().getConnection();
map.from(connection::getMode).whenNonNull().to(connectionFactory::setCacheMode);
map.from(connection::getSize).whenNonNull().to(connectionFactory::setConnectionCacheSize);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -126,7 +126,7 @@ public class RabbitAutoConfiguration {
connectionFactoryBean.afterPropertiesSet();
com.rabbitmq.client.ConnectionFactory connectionFactory = connectionFactoryBean.getObject();
connectionFactoryCustomizers.orderedStream()
.forEach((customizer) -> customizer.customize(connectionFactory));
.forEach((customizer) -> customizer.customize(connectionFactory));
CachingConnectionFactory factory = new CachingConnectionFactory(connectionFactory);
rabbitCachingConnectionFactoryConfigurer.configure(factory);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -71,8 +71,10 @@ public class RabbitConnectionFactoryBeanConfigurer {
map.from(this.rabbitProperties::determineUsername).whenNonNull().to(factory::setUsername);
map.from(this.rabbitProperties::determinePassword).whenNonNull().to(factory::setPassword);
map.from(this.rabbitProperties::determineVirtualHost).whenNonNull().to(factory::setVirtualHost);
map.from(this.rabbitProperties::getRequestedHeartbeat).whenNonNull().asInt(Duration::getSeconds)
.to(factory::setRequestedHeartbeat);
map.from(this.rabbitProperties::getRequestedHeartbeat)
.whenNonNull()
.asInt(Duration::getSeconds)
.to(factory::setRequestedHeartbeat);
map.from(this.rabbitProperties::getRequestedChannelMax).to(factory::setRequestedChannelMax);
RabbitProperties.Ssl ssl = this.rabbitProperties.getSsl();
if (ssl.determineEnabled()) {
@@ -87,13 +89,17 @@ public class RabbitConnectionFactoryBeanConfigurer {
map.from(ssl::getTrustStorePassword).to(factory::setTrustStorePassphrase);
map.from(ssl::getTrustStoreAlgorithm).whenNonNull().to(factory::setTrustStoreAlgorithm);
map.from(ssl::isValidateServerCertificate)
.to((validate) -> factory.setSkipServerCertificateValidation(!validate));
.to((validate) -> factory.setSkipServerCertificateValidation(!validate));
map.from(ssl::getVerifyHostname).to(factory::setEnableHostnameVerification);
}
map.from(this.rabbitProperties::getConnectionTimeout).whenNonNull().asInt(Duration::toMillis)
.to(factory::setConnectionTimeout);
map.from(this.rabbitProperties::getChannelRpcTimeout).whenNonNull().asInt(Duration::toMillis)
.to(factory::setChannelRpcTimeout);
map.from(this.rabbitProperties::getConnectionTimeout)
.whenNonNull()
.asInt(Duration::toMillis)
.to(factory::setConnectionTimeout);
map.from(this.rabbitProperties::getChannelRpcTimeout)
.whenNonNull()
.asInt(Duration::toMillis)
.to(factory::setChannelRpcTimeout);
map.from(this.credentialsProvider).whenNonNull().to(factory::setCredentialsProvider);
map.from(this.credentialsRefreshService).whenNonNull().to(factory::setCredentialsRefreshService);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -88,12 +88,16 @@ public class RabbitTemplateConfigurer {
RabbitProperties.Template templateProperties = this.rabbitProperties.getTemplate();
if (templateProperties.getRetry().isEnabled()) {
template.setRetryTemplate(new RetryTemplateFactory(this.retryTemplateCustomizers)
.createRetryTemplate(templateProperties.getRetry(), RabbitRetryTemplateCustomizer.Target.SENDER));
.createRetryTemplate(templateProperties.getRetry(), RabbitRetryTemplateCustomizer.Target.SENDER));
}
map.from(templateProperties::getReceiveTimeout).whenNonNull().as(Duration::toMillis)
.to(template::setReceiveTimeout);
map.from(templateProperties::getReplyTimeout).whenNonNull().as(Duration::toMillis)
.to(template::setReplyTimeout);
map.from(templateProperties::getReceiveTimeout)
.whenNonNull()
.as(Duration::toMillis)
.to(template::setReceiveTimeout);
map.from(templateProperties::getReplyTimeout)
.whenNonNull()
.as(Duration::toMillis)
.to(template::setReplyTimeout);
map.from(templateProperties::getExchange).to(template::setExchange);
map.from(templateProperties::getRoutingKey).to(template::setRoutingKey);
map.from(templateProperties::getDefaultReceiveQueue).whenNonNull().to(template::setDefaultReceiveQueue);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,8 +45,10 @@ class RetryTemplateFactory {
map.from(properties::getMaxAttempts).to(policy::setMaxAttempts);
template.setRetryPolicy(policy);
ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy();
map.from(properties::getInitialInterval).whenNonNull().as(Duration::toMillis)
.to(backOffPolicy::setInitialInterval);
map.from(properties::getInitialInterval)
.whenNonNull()
.as(Duration::toMillis)
.to(backOffPolicy::setInitialInterval);
map.from(properties::getMultiplier).to(backOffPolicy::setMultiplier);
map.from(properties::getMaxInterval).whenNonNull().as(Duration::toMillis).to(backOffPolicy::setMaxInterval);
template.setBackOffPolicy(backOffPolicy);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -210,7 +210,8 @@ public class JobLauncherApplicationRunner implements ApplicationRunner, Ordered,
return jobParameters;
}
JobParameters nextParameters = new JobParametersBuilder(jobParameters, this.jobExplorer)
.getNextJobParameters(job).toJobParameters();
.getNextJobParameters(job)
.toJobParameters();
return merge(nextParameters, jobParameters);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,7 +49,8 @@ public class CacheManagerCustomizers {
@SuppressWarnings("unchecked")
public <T extends CacheManager> T customize(T cacheManager) {
LambdaSafe.callbacks(CacheManagerCustomizer.class, this.customizers, cacheManager)
.withLogger(CacheManagerCustomizers.class).invoke((customizer) -> customizer.customize(cacheManager));
.withLogger(CacheManagerCustomizers.class)
.invoke((customizer) -> customizer.customize(cacheManager));
return cacheManager;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ class CouchbaseCacheConfiguration {
CouchbaseCacheManagerBuilder builder = CouchbaseCacheManager.builder(clientFactory);
Couchbase couchbase = cacheProperties.getCouchbase();
org.springframework.data.couchbase.cache.CouchbaseCacheConfiguration config = org.springframework.data.couchbase.cache.CouchbaseCacheConfiguration
.defaultCacheConfig();
.defaultCacheConfig();
if (couchbase.getExpiration() != null) {
config = config.entryExpiry(couchbase.getExpiration());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -114,7 +114,7 @@ class JCacheCacheConfiguration implements BeanClassLoaderAware {
ObjectProvider<JCachePropertiesCustomizer> cachePropertiesCustomizers, CacheProperties cacheProperties) {
Properties properties = new Properties();
cachePropertiesCustomizers.orderedStream()
.forEach((customizer) -> customizer.customize(cacheProperties, properties));
.forEach((customizer) -> customizer.customize(cacheProperties, properties));
return properties;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,8 +57,9 @@ class RedisCacheConfiguration {
ObjectProvider<org.springframework.data.redis.cache.RedisCacheConfiguration> redisCacheConfiguration,
ObjectProvider<RedisCacheManagerBuilderCustomizer> redisCacheManagerBuilderCustomizers,
RedisConnectionFactory redisConnectionFactory, ResourceLoader resourceLoader) {
RedisCacheManagerBuilder builder = RedisCacheManager.builder(redisConnectionFactory).cacheDefaults(
determineConfiguration(cacheProperties, redisCacheConfiguration, resourceLoader.getClassLoader()));
RedisCacheManagerBuilder builder = RedisCacheManager.builder(redisConnectionFactory)
.cacheDefaults(
determineConfiguration(cacheProperties, redisCacheConfiguration, resourceLoader.getClassLoader()));
List<String> cacheNames = cacheProperties.getCacheNames();
if (!cacheNames.isEmpty()) {
builder.initialCacheNames(new LinkedHashSet<>(cacheNames));
@@ -81,9 +82,9 @@ class RedisCacheConfiguration {
CacheProperties cacheProperties, ClassLoader classLoader) {
Redis redisProperties = cacheProperties.getRedis();
org.springframework.data.redis.cache.RedisCacheConfiguration config = org.springframework.data.redis.cache.RedisCacheConfiguration
.defaultCacheConfig();
config = config.serializeValuesWith(
SerializationPair.fromSerializer(new JdkSerializationRedisSerializer(classLoader)));
.defaultCacheConfig();
config = config
.serializeValuesWith(SerializationPair.fromSerializer(new JdkSerializationRedisSerializer(classLoader)));
if (redisProperties.getTimeToLive() != null) {
config = config.entryTtl(redisProperties.getTimeToLive());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -151,77 +151,91 @@ public class CassandraAutoConfiguration {
private Config mapConfig(CassandraProperties properties) {
CassandraDriverOptions options = new CassandraDriverOptions();
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(properties.getSessionName()).whenHasText()
.to((sessionName) -> options.add(DefaultDriverOption.SESSION_NAME, sessionName));
map.from(properties.getSessionName())
.whenHasText()
.to((sessionName) -> options.add(DefaultDriverOption.SESSION_NAME, sessionName));
map.from(properties::getUsername)
.to((username) -> options.add(DefaultDriverOption.AUTH_PROVIDER_USER_NAME, username)
.add(DefaultDriverOption.AUTH_PROVIDER_PASSWORD, properties.getPassword()));
.to((username) -> options.add(DefaultDriverOption.AUTH_PROVIDER_USER_NAME, username)
.add(DefaultDriverOption.AUTH_PROVIDER_PASSWORD, properties.getPassword()));
map.from(properties::getCompression)
.to((compression) -> options.add(DefaultDriverOption.PROTOCOL_COMPRESSION, compression));
.to((compression) -> options.add(DefaultDriverOption.PROTOCOL_COMPRESSION, compression));
mapConnectionOptions(properties, options);
mapPoolingOptions(properties, options);
mapRequestOptions(properties, options);
mapControlConnectionOptions(properties, options);
map.from(mapContactPoints(properties))
.to((contactPoints) -> options.add(DefaultDriverOption.CONTACT_POINTS, contactPoints));
map.from(properties.getLocalDatacenter()).whenHasText().to(
(localDatacenter) -> options.add(DefaultDriverOption.LOAD_BALANCING_LOCAL_DATACENTER, localDatacenter));
.to((contactPoints) -> options.add(DefaultDriverOption.CONTACT_POINTS, contactPoints));
map.from(properties.getLocalDatacenter())
.whenHasText()
.to((localDatacenter) -> options.add(DefaultDriverOption.LOAD_BALANCING_LOCAL_DATACENTER, localDatacenter));
return options.build();
}
private void mapConnectionOptions(CassandraProperties properties, CassandraDriverOptions options) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
Connection connectionProperties = properties.getConnection();
map.from(connectionProperties::getConnectTimeout).asInt(Duration::toMillis)
.to((connectTimeout) -> options.add(DefaultDriverOption.CONNECTION_CONNECT_TIMEOUT, connectTimeout));
map.from(connectionProperties::getInitQueryTimeout).asInt(Duration::toMillis).to(
(initQueryTimeout) -> options.add(DefaultDriverOption.CONNECTION_INIT_QUERY_TIMEOUT, initQueryTimeout));
map.from(connectionProperties::getConnectTimeout)
.asInt(Duration::toMillis)
.to((connectTimeout) -> options.add(DefaultDriverOption.CONNECTION_CONNECT_TIMEOUT, connectTimeout));
map.from(connectionProperties::getInitQueryTimeout)
.asInt(Duration::toMillis)
.to((initQueryTimeout) -> options.add(DefaultDriverOption.CONNECTION_INIT_QUERY_TIMEOUT, initQueryTimeout));
}
private void mapPoolingOptions(CassandraProperties properties, CassandraDriverOptions options) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
CassandraProperties.Pool poolProperties = properties.getPool();
map.from(poolProperties::getIdleTimeout).asInt(Duration::toMillis)
.to((idleTimeout) -> options.add(DefaultDriverOption.HEARTBEAT_TIMEOUT, idleTimeout));
map.from(poolProperties::getHeartbeatInterval).asInt(Duration::toMillis)
.to((heartBeatInterval) -> options.add(DefaultDriverOption.HEARTBEAT_INTERVAL, heartBeatInterval));
map.from(poolProperties::getIdleTimeout)
.asInt(Duration::toMillis)
.to((idleTimeout) -> options.add(DefaultDriverOption.HEARTBEAT_TIMEOUT, idleTimeout));
map.from(poolProperties::getHeartbeatInterval)
.asInt(Duration::toMillis)
.to((heartBeatInterval) -> options.add(DefaultDriverOption.HEARTBEAT_INTERVAL, heartBeatInterval));
}
private void mapRequestOptions(CassandraProperties properties, CassandraDriverOptions options) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
Request requestProperties = properties.getRequest();
map.from(requestProperties::getTimeout).asInt(Duration::toMillis)
.to(((timeout) -> options.add(DefaultDriverOption.REQUEST_TIMEOUT, timeout)));
map.from(requestProperties::getTimeout)
.asInt(Duration::toMillis)
.to(((timeout) -> options.add(DefaultDriverOption.REQUEST_TIMEOUT, timeout)));
map.from(requestProperties::getConsistency)
.to(((consistency) -> options.add(DefaultDriverOption.REQUEST_CONSISTENCY, consistency)));
map.from(requestProperties::getSerialConsistency).to(
(serialConsistency) -> options.add(DefaultDriverOption.REQUEST_SERIAL_CONSISTENCY, serialConsistency));
.to(((consistency) -> options.add(DefaultDriverOption.REQUEST_CONSISTENCY, consistency)));
map.from(requestProperties::getSerialConsistency)
.to((serialConsistency) -> options.add(DefaultDriverOption.REQUEST_SERIAL_CONSISTENCY, serialConsistency));
map.from(requestProperties::getPageSize)
.to((pageSize) -> options.add(DefaultDriverOption.REQUEST_PAGE_SIZE, pageSize));
.to((pageSize) -> options.add(DefaultDriverOption.REQUEST_PAGE_SIZE, pageSize));
Throttler throttlerProperties = requestProperties.getThrottler();
map.from(throttlerProperties::getType).as(ThrottlerType::type)
.to((type) -> options.add(DefaultDriverOption.REQUEST_THROTTLER_CLASS, type));
map.from(throttlerProperties::getType)
.as(ThrottlerType::type)
.to((type) -> options.add(DefaultDriverOption.REQUEST_THROTTLER_CLASS, type));
map.from(throttlerProperties::getMaxQueueSize)
.to((maxQueueSize) -> options.add(DefaultDriverOption.REQUEST_THROTTLER_MAX_QUEUE_SIZE, maxQueueSize));
map.from(throttlerProperties::getMaxConcurrentRequests).to((maxConcurrentRequests) -> options
.add(DefaultDriverOption.REQUEST_THROTTLER_MAX_CONCURRENT_REQUESTS, maxConcurrentRequests));
map.from(throttlerProperties::getMaxRequestsPerSecond).to((maxRequestsPerSecond) -> options
.add(DefaultDriverOption.REQUEST_THROTTLER_MAX_REQUESTS_PER_SECOND, maxRequestsPerSecond));
map.from(throttlerProperties::getDrainInterval).asInt(Duration::toMillis).to(
(drainInterval) -> options.add(DefaultDriverOption.REQUEST_THROTTLER_DRAIN_INTERVAL, drainInterval));
.to((maxQueueSize) -> options.add(DefaultDriverOption.REQUEST_THROTTLER_MAX_QUEUE_SIZE, maxQueueSize));
map.from(throttlerProperties::getMaxConcurrentRequests)
.to((maxConcurrentRequests) -> options.add(DefaultDriverOption.REQUEST_THROTTLER_MAX_CONCURRENT_REQUESTS,
maxConcurrentRequests));
map.from(throttlerProperties::getMaxRequestsPerSecond)
.to((maxRequestsPerSecond) -> options.add(DefaultDriverOption.REQUEST_THROTTLER_MAX_REQUESTS_PER_SECOND,
maxRequestsPerSecond));
map.from(throttlerProperties::getDrainInterval)
.asInt(Duration::toMillis)
.to((drainInterval) -> options.add(DefaultDriverOption.REQUEST_THROTTLER_DRAIN_INTERVAL, drainInterval));
}
private void mapControlConnectionOptions(CassandraProperties properties, CassandraDriverOptions options) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
Controlconnection controlProperties = properties.getControlconnection();
map.from(controlProperties::getTimeout).asInt(Duration::toMillis)
.to((timeout) -> options.add(DefaultDriverOption.CONTROL_CONNECTION_TIMEOUT, timeout));
map.from(controlProperties::getTimeout)
.asInt(Duration::toMillis)
.to((timeout) -> options.add(DefaultDriverOption.CONTROL_CONNECTION_TIMEOUT, timeout));
}
private List<String> mapContactPoints(CassandraProperties properties) {
if (properties.getContactPoints() != null) {
return properties.getContactPoints().stream()
.map((candidate) -> formatContactPoint(candidate, properties.getPort())).toList();
return properties.getContactPoints()
.stream()
.map((candidate) -> formatContactPoint(candidate, properties.getPort()))
.toList();
}
return null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -167,7 +167,7 @@ public abstract class AbstractNestedCondition extends SpringBootCondition implem
List<ConditionOutcome> getMatchOutcomes() {
List<ConditionOutcome> outcomes = new ArrayList<>();
this.memberConditions.forEach((metadata, conditions) -> outcomes
.add(new MemberOutcomes(this.context, metadata, conditions).getUltimateOutcome()));
.add(new MemberOutcomes(this.context, metadata, conditions).getUltimateOutcome()));
return Collections.unmodifiableList(outcomes);
}
@@ -199,7 +199,7 @@ public abstract class AbstractNestedCondition extends SpringBootCondition implem
ConditionOutcome getUltimateOutcome() {
ConditionMessage.Builder message = ConditionMessage
.forCondition("NestedCondition on " + ClassUtils.getShortName(this.metadata.getClassName()));
.forCondition("NestedCondition on " + ClassUtils.getShortName(this.metadata.getClassName()));
if (this.outcomes.size() == 1) {
ConditionOutcome outcome = this.outcomes.get(0);
return new ConditionOutcome(outcome.isMatch(), message.because(outcome.getMessage()));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,8 +62,9 @@ public abstract class AllNestedConditions extends AbstractNestedCondition {
protected ConditionOutcome getFinalMatchOutcome(MemberMatchOutcomes memberOutcomes) {
boolean match = hasSameSize(memberOutcomes.getMatches(), memberOutcomes.getAll());
List<ConditionMessage> messages = new ArrayList<>();
messages.add(ConditionMessage.forCondition("AllNestedConditions").because(
memberOutcomes.getMatches().size() + " matched " + memberOutcomes.getNonMatches().size() + " did not"));
messages.add(ConditionMessage.forCondition("AllNestedConditions")
.because(memberOutcomes.getMatches().size() + " matched " + memberOutcomes.getNonMatches().size()
+ " did not"));
for (ConditionOutcome outcome : memberOutcomes.getAll()) {
messages.add(outcome.getConditionMessage());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,8 +65,9 @@ public abstract class AnyNestedCondition extends AbstractNestedCondition {
protected ConditionOutcome getFinalMatchOutcome(MemberMatchOutcomes memberOutcomes) {
boolean match = !memberOutcomes.getMatches().isEmpty();
List<ConditionMessage> messages = new ArrayList<>();
messages.add(ConditionMessage.forCondition("AnyNestedCondition").because(
memberOutcomes.getMatches().size() + " matched " + memberOutcomes.getNonMatches().size() + " did not"));
messages.add(ConditionMessage.forCondition("AnyNestedCondition")
.because(memberOutcomes.getMatches().size() + " matched " + memberOutcomes.getNonMatches().size()
+ " did not"));
for (ConditionOutcome outcome : memberOutcomes.getAll()) {
messages.add(outcome.getConditionMessage());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -127,7 +127,7 @@ public final class ConditionEvaluationReport {
this.outcomes.forEach((candidateSource, sourceOutcomes) -> {
if (candidateSource.startsWith(prefix)) {
ConditionOutcome outcome = ConditionOutcome
.noMatch(ConditionMessage.forCondition("Ancestor " + source).because("did not match"));
.noMatch(ConditionMessage.forCondition("Ancestor " + source).because("did not match"));
sourceOutcomes.add(ANCESTOR_CONDITION, outcome);
}
});

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,8 +62,9 @@ public abstract class NoneNestedConditions extends AbstractNestedCondition {
protected ConditionOutcome getFinalMatchOutcome(MemberMatchOutcomes memberOutcomes) {
boolean match = memberOutcomes.getMatches().isEmpty();
List<ConditionMessage> messages = new ArrayList<>();
messages.add(ConditionMessage.forCondition("NoneNestedConditions").because(
memberOutcomes.getMatches().size() + " matched " + memberOutcomes.getNonMatches().size() + " did not"));
messages.add(ConditionMessage.forCondition("NoneNestedConditions")
.because(memberOutcomes.getMatches().size() + " matched " + memberOutcomes.getNonMatches().size()
+ " did not"));
for (ConditionOutcome outcome : memberOutcomes.getAll()) {
messages.add(outcome.getConditionMessage());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -104,7 +104,8 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
List<String> missing = filter(requiredBeanTypes, ClassNameFilter.MISSING, getBeanClassLoader());
if (!missing.isEmpty()) {
ConditionMessage message = ConditionMessage.forCondition(annotation)
.didNotFind("required type", "required types").items(Style.QUOTE, missing);
.didNotFind("required type", "required types")
.items(Style.QUOTE, missing);
return ConditionOutcome.noMatch(message);
}
return null;
@@ -121,8 +122,9 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
String reason = createOnBeanNoMatchReason(matchResult);
return ConditionOutcome.noMatch(spec.message().because(reason));
}
matchMessage = spec.message(matchMessage).found("bean", "beans").items(Style.QUOTE,
matchResult.getNamesOfAllMatches());
matchMessage = spec.message(matchMessage)
.found("bean", "beans")
.items(Style.QUOTE, matchResult.getNamesOfAllMatches());
}
if (metadata.isAnnotated(ConditionalOnSingleCandidate.class.getName())) {
Spec<ConditionalOnSingleCandidate> spec = new SingleCandidateSpec(context, metadata, annotations);
@@ -138,16 +140,16 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
List<String> primaryBeans = getPrimaryBeans(context.getBeanFactory(), allBeans,
spec.getStrategy() == SearchStrategy.ALL);
if (primaryBeans.isEmpty()) {
return ConditionOutcome.noMatch(
spec.message().didNotFind("a primary bean from beans").items(Style.QUOTE, allBeans));
return ConditionOutcome
.noMatch(spec.message().didNotFind("a primary bean from beans").items(Style.QUOTE, allBeans));
}
if (primaryBeans.size() > 1) {
return ConditionOutcome
.noMatch(spec.message().found("multiple primary beans").items(Style.QUOTE, primaryBeans));
.noMatch(spec.message().found("multiple primary beans").items(Style.QUOTE, primaryBeans));
}
matchMessage = spec.message(matchMessage)
.found("a single primary bean '" + primaryBeans.get(0) + "' from beans")
.items(Style.QUOTE, allBeans);
.found("a single primary bean '" + primaryBeans.get(0) + "' from beans")
.items(Style.QUOTE, allBeans);
}
}
if (metadata.isAnnotated(ConditionalOnMissingBean.class.getName())) {
@@ -418,8 +420,8 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
Spec(ConditionContext context, AnnotatedTypeMetadata metadata, MergedAnnotations annotations,
Class<A> annotationType) {
MultiValueMap<String, Object> attributes = annotations.stream(annotationType)
.filter(MergedAnnotationPredicates.unique(MergedAnnotation::getMetaTypes))
.collect(MergedAnnotationCollectors.toMultiValueMap(Adapt.CLASS_TO_STRING));
.filter(MergedAnnotationPredicates.unique(MergedAnnotation::getMetaTypes))
.collect(MergedAnnotationCollectors.toMultiValueMap(Adapt.CLASS_TO_STRING));
MergedAnnotation<A> annotation = annotations.get(annotationType);
this.classLoader = context.getClassLoader();
this.annotationType = annotationType;
@@ -567,7 +569,7 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
private boolean isBeanMethod(Method method) {
return method != null && MergedAnnotations.from(method, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY)
.isPresent(Bean.class);
.isPresent(Bean.class);
}
private SearchStrategy getStrategy() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -89,22 +89,24 @@ class OnClassCondition extends FilteringSpringBootCondition {
List<String> missing = filter(onClasses, ClassNameFilter.MISSING, classLoader);
if (!missing.isEmpty()) {
return ConditionOutcome.noMatch(ConditionMessage.forCondition(ConditionalOnClass.class)
.didNotFind("required class", "required classes").items(Style.QUOTE, missing));
.didNotFind("required class", "required classes")
.items(Style.QUOTE, missing));
}
matchMessage = matchMessage.andCondition(ConditionalOnClass.class)
.found("required class", "required classes")
.items(Style.QUOTE, filter(onClasses, ClassNameFilter.PRESENT, classLoader));
.found("required class", "required classes")
.items(Style.QUOTE, filter(onClasses, ClassNameFilter.PRESENT, classLoader));
}
List<String> onMissingClasses = getCandidates(metadata, ConditionalOnMissingClass.class);
if (onMissingClasses != null) {
List<String> present = filter(onMissingClasses, ClassNameFilter.PRESENT, classLoader);
if (!present.isEmpty()) {
return ConditionOutcome.noMatch(ConditionMessage.forCondition(ConditionalOnMissingClass.class)
.found("unwanted class", "unwanted classes").items(Style.QUOTE, present));
.found("unwanted class", "unwanted classes")
.items(Style.QUOTE, present));
}
matchMessage = matchMessage.andCondition(ConditionalOnMissingClass.class)
.didNotFind("unwanted class", "unwanted classes")
.items(Style.QUOTE, filter(onMissingClasses, ClassNameFilter.MISSING, classLoader));
.didNotFind("unwanted class", "unwanted classes")
.items(Style.QUOTE, filter(onMissingClasses, ClassNameFilter.MISSING, classLoader));
}
return ConditionOutcome.match(matchMessage);
}
@@ -220,7 +222,8 @@ class OnClassCondition extends FilteringSpringBootCondition {
private ConditionOutcome getOutcome(String className, ClassLoader classLoader) {
if (ClassNameFilter.MISSING.matches(className, classLoader)) {
return ConditionOutcome.noMatch(ConditionMessage.forCondition(ConditionalOnClass.class)
.didNotFind("required class").items(Style.QUOTE, className));
.didNotFind("required class")
.items(Style.QUOTE, className));
}
return null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ class OnExpressionCondition extends SpringBootCondition {
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
String expression = (String) metadata.getAnnotationAttributes(ConditionalOnExpression.class.getName())
.get("value");
.get("value");
expression = wrapIfNecessary(expression);
ConditionMessage.Builder messageBuilder = ConditionMessage.forCondition(ConditionalOnExpression.class,
"(" + expression + ")");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,7 +50,7 @@ class OnJavaCondition extends SpringBootCondition {
boolean match = isWithin(runningVersion, range, version);
String expected = String.format((range != Range.EQUAL_OR_NEWER) ? "(older than %s)" : "(%s or newer)", version);
ConditionMessage message = ConditionMessage.forCondition(ConditionalOnJava.class, expected)
.foundExactly(runningVersion);
.foundExactly(runningVersion);
return new ConditionOutcome(match, message);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,35 +40,36 @@ class OnJndiCondition extends SpringBootCondition {
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
AnnotationAttributes annotationAttributes = AnnotationAttributes
.fromMap(metadata.getAnnotationAttributes(ConditionalOnJndi.class.getName()));
.fromMap(metadata.getAnnotationAttributes(ConditionalOnJndi.class.getName()));
String[] locations = annotationAttributes.getStringArray("value");
try {
return getMatchOutcome(locations);
}
catch (NoClassDefFoundError ex) {
return ConditionOutcome
.noMatch(ConditionMessage.forCondition(ConditionalOnJndi.class).because("JNDI class not found"));
.noMatch(ConditionMessage.forCondition(ConditionalOnJndi.class).because("JNDI class not found"));
}
}
private ConditionOutcome getMatchOutcome(String[] locations) {
if (!isJndiAvailable()) {
return ConditionOutcome
.noMatch(ConditionMessage.forCondition(ConditionalOnJndi.class).notAvailable("JNDI environment"));
.noMatch(ConditionMessage.forCondition(ConditionalOnJndi.class).notAvailable("JNDI environment"));
}
if (locations.length == 0) {
return ConditionOutcome
.match(ConditionMessage.forCondition(ConditionalOnJndi.class).available("JNDI environment"));
.match(ConditionMessage.forCondition(ConditionalOnJndi.class).available("JNDI environment"));
}
JndiLocator locator = getJndiLocator(locations);
String location = locator.lookupFirstLocation();
String details = "(" + StringUtils.arrayToCommaDelimitedString(locations) + ")";
if (location != null) {
return ConditionOutcome.match(ConditionMessage.forCondition(ConditionalOnJndi.class, details)
.foundExactly("\"" + location + "\""));
.foundExactly("\"" + location + "\""));
}
return ConditionOutcome.noMatch(ConditionMessage.forCondition(ConditionalOnJndi.class, details)
.didNotFind("any matching JNDI location").atAll());
.didNotFind("any matching JNDI location")
.atAll());
}
protected boolean isJndiAvailable() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,9 +48,10 @@ class OnPropertyCondition extends SpringBootCondition {
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
List<AnnotationAttributes> allAnnotationAttributes = metadata.getAnnotations()
.stream(ConditionalOnProperty.class.getName())
.filter(MergedAnnotationPredicates.unique(MergedAnnotation::getMetaTypes))
.map(MergedAnnotation::asAnnotationAttributes).toList();
.stream(ConditionalOnProperty.class.getName())
.filter(MergedAnnotationPredicates.unique(MergedAnnotation::getMetaTypes))
.map(MergedAnnotation::asAnnotationAttributes)
.toList();
List<ConditionMessage> noMatch = new ArrayList<>();
List<ConditionMessage> match = new ArrayList<>();
for (AnnotationAttributes annotationAttributes : allAnnotationAttributes) {
@@ -70,15 +71,16 @@ class OnPropertyCondition extends SpringBootCondition {
spec.collectProperties(resolver, missingProperties, nonMatchingProperties);
if (!missingProperties.isEmpty()) {
return ConditionOutcome.noMatch(ConditionMessage.forCondition(ConditionalOnProperty.class, spec)
.didNotFind("property", "properties").items(Style.QUOTE, missingProperties));
.didNotFind("property", "properties")
.items(Style.QUOTE, missingProperties));
}
if (!nonMatchingProperties.isEmpty()) {
return ConditionOutcome.noMatch(ConditionMessage.forCondition(ConditionalOnProperty.class, spec)
.found("different value in property", "different value in properties")
.items(Style.QUOTE, nonMatchingProperties));
.found("different value in property", "different value in properties")
.items(Style.QUOTE, nonMatchingProperties));
}
return ConditionOutcome
.match(ConditionMessage.forCondition(ConditionalOnProperty.class, spec).because("matched"));
.match(ConditionMessage.forCondition(ConditionalOnProperty.class, spec).because("matched"));
}
private static class Spec {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ class OnResourceCondition extends SpringBootCondition {
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
MultiValueMap<String, Object> attributes = metadata
.getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true);
.getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true);
ResourceLoader loader = context.getResourceLoader();
List<String> locations = new ArrayList<>();
collectValues(locations, attributes.get("resources"));
@@ -56,10 +56,12 @@ class OnResourceCondition extends SpringBootCondition {
}
if (!missing.isEmpty()) {
return ConditionOutcome.noMatch(ConditionMessage.forCondition(ConditionalOnResource.class)
.didNotFind("resource", "resources").items(Style.QUOTE, missing));
.didNotFind("resource", "resources")
.items(Style.QUOTE, missing));
}
return ConditionOutcome.match(ConditionMessage.forCondition(ConditionalOnResource.class)
.found("location", "locations").items(locations));
.found("location", "locations")
.items(locations));
}
private void collectValues(List<String> names, List<Object> values) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ class OnWarDeploymentCondition extends SpringBootCondition {
}
}
return ConditionOutcome.noMatch(ConditionMessage.forCondition(ConditionalOnWarDeployment.class)
.because("the application is not deployed as a WAR file."));
.because("the application is not deployed as a WAR file."));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -80,8 +80,8 @@ public abstract class ResourceCondition extends SpringBootCondition {
}
}
if (found.isEmpty()) {
ConditionMessage message = startConditionMessage().didNotFind("resource", "resources").items(Style.QUOTE,
Arrays.asList(this.resourceLocations));
ConditionMessage message = startConditionMessage().didNotFind("resource", "resources")
.items(Style.QUOTE, Arrays.asList(this.resourceLocations));
return ConditionOutcome.noMatch(message);
}
ConditionMessage message = startConditionMessage().found("resource", "resources").items(Style.QUOTE, found);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -101,8 +101,8 @@ public abstract class SpringBootCondition implements Condition {
private void recordEvaluation(ConditionContext context, String classOrMethodName, ConditionOutcome outcome) {
if (context.getBeanFactory() != null) {
ConditionEvaluationReport.get(context.getBeanFactory()).recordConditionEvaluation(classOrMethodName, this,
outcome);
ConditionEvaluationReport.get(context.getBeanFactory())
.recordConditionEvaluation(classOrMethodName, this, outcome);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,7 +70,7 @@ public class MessageSourceAutoConfiguration {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
if (StringUtils.hasText(properties.getBasename())) {
messageSource.setBasenames(StringUtils
.commaDelimitedListToStringArray(StringUtils.trimAllWhitespace(properties.getBasename())));
.commaDelimitedListToStringArray(StringUtils.trimAllWhitespace(properties.getBasename())));
}
if (properties.getEncoding() != null) {
messageSource.setDefaultEncoding(properties.getEncoding().name());
@@ -116,7 +116,7 @@ public class MessageSourceAutoConfiguration {
String target = name.replace('.', '/');
try {
return new PathMatchingResourcePatternResolver(classLoader)
.getResources("classpath*:" + target + ".properties");
.getResources("classpath*:" + target + ".properties");
}
catch (Exception ex) {
return NO_RESOURCES;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,7 +73,7 @@ public class CouchbaseAutoConfiguration {
@ConditionalOnMissingBean
public Cluster couchbaseCluster(CouchbaseProperties properties, ClusterEnvironment couchbaseClusterEnvironment) {
ClusterOptions options = ClusterOptions.clusterOptions(properties.getUsername(), properties.getPassword())
.environment(couchbaseClusterEnvironment);
.environment(couchbaseClusterEnvironment);
return Cluster.connect(properties.getConnectionString(), options);
}
@@ -81,16 +81,21 @@ public class CouchbaseAutoConfiguration {
ClusterEnvironment.Builder builder = ClusterEnvironment.builder();
Timeouts timeouts = properties.getEnv().getTimeouts();
builder.timeoutConfig((config) -> config.kvTimeout(timeouts.getKeyValue())
.analyticsTimeout(timeouts.getAnalytics()).kvDurableTimeout(timeouts.getKeyValueDurable())
.queryTimeout(timeouts.getQuery()).viewTimeout(timeouts.getView()).searchTimeout(timeouts.getSearch())
.managementTimeout(timeouts.getManagement()).connectTimeout(timeouts.getConnect())
.disconnectTimeout(timeouts.getDisconnect()));
.analyticsTimeout(timeouts.getAnalytics())
.kvDurableTimeout(timeouts.getKeyValueDurable())
.queryTimeout(timeouts.getQuery())
.viewTimeout(timeouts.getView())
.searchTimeout(timeouts.getSearch())
.managementTimeout(timeouts.getManagement())
.connectTimeout(timeouts.getConnect())
.disconnectTimeout(timeouts.getDisconnect()));
CouchbaseProperties.Io io = properties.getEnv().getIo();
builder.ioConfig((config) -> config.maxHttpConnections(io.getMaxEndpoints())
.numKvConnections(io.getMinEndpoints()).idleHttpConnectionTimeout(io.getIdleHttpConnectionTimeout()));
.numKvConnections(io.getMinEndpoints())
.idleHttpConnectionTimeout(io.getIdleHttpConnectionTimeout()));
if (properties.getEnv().getSsl().getEnabled()) {
builder.securityConfig((config) -> config.enableTls(true)
.trustManagerFactory(getTrustManagerFactory(properties.getEnv().getSsl())));
.trustManagerFactory(getTrustManagerFactory(properties.getEnv().getSsl())));
}
return builder;
}
@@ -99,7 +104,7 @@ public class CouchbaseAutoConfiguration {
String resource = ssl.getKeyStore();
try {
TrustManagerFactory trustManagerFactory = TrustManagerFactory
.getInstance(KeyManagerFactory.getDefaultAlgorithm());
.getInstance(KeyManagerFactory.getDefaultAlgorithm());
KeyStore keyStore = loadKeyStore(resource, ssl.getKeyStorePassword());
trustManagerFactory.init(keyStore);
return trustManagerFactory;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@ class OnRepositoryTypeCondition extends SpringBootCondition {
ConditionMessage.Builder message = ConditionMessage.forCondition(ConditionalOnRepositoryType.class);
if (configuredType == requiredType || configuredType == RepositoryType.AUTO) {
return ConditionOutcome
.match(message.because("configured type of '" + configuredType.name() + "' matched required type"));
.match(message.because("configured type of '" + configuredType.name() + "' matched required type"));
}
return ConditionOutcome.noMatch(message.because("configured type (" + configuredType.name()
+ ") did not match required type (" + requiredType.name() + ")"));
@@ -51,8 +51,8 @@ class OnRepositoryTypeCondition extends SpringBootCondition {
private RepositoryType getTypeProperty(Environment environment, String store) {
return RepositoryType
.valueOf(environment.getProperty(String.format("spring.data.%s.repositories.type", store), "auto")
.toUpperCase(Locale.ENGLISH));
.valueOf(environment.getProperty(String.format("spring.data.%s.repositories.type", store), "auto")
.toUpperCase(Locale.ENGLISH));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -68,7 +68,7 @@ class CouchbaseDataConfiguration {
Class<?> fieldNamingStrategy = properties.getFieldNamingStrategy();
if (fieldNamingStrategy != null) {
mappingContext
.setFieldNamingStrategy((FieldNamingStrategy) BeanUtils.instantiateClass(fieldNamingStrategy));
.setFieldNamingStrategy((FieldNamingStrategy) BeanUtils.instantiateClass(fieldNamingStrategy));
}
mappingContext.setAutoIndexCreation(properties.isAutoIndex());
return mappingContext;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -148,7 +148,7 @@ class LettuceConnectionConfiguration extends RedisConnectionConfiguration {
ClusterClientOptions.Builder builder = ClusterClientOptions.builder();
Refresh refreshProperties = getProperties().getLettuce().getCluster().getRefresh();
Builder refreshBuilder = ClusterTopologyRefreshOptions.builder()
.dynamicRefreshSources(refreshProperties.isDynamicRefreshSources());
.dynamicRefreshSources(refreshProperties.isDynamicRefreshSources());
if (refreshProperties.getPeriod() != null) {
refreshBuilder.enablePeriodicRefresh(refreshProperties.getPeriod());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,8 +51,12 @@ public class RedisReactiveAutoConfiguration {
JdkSerializationRedisSerializer jdkSerializer = new JdkSerializationRedisSerializer(
resourceLoader.getClassLoader());
RedisSerializationContext<Object, Object> serializationContext = RedisSerializationContext
.newSerializationContext().key(jdkSerializer).value(jdkSerializer).hashKey(jdkSerializer)
.hashValue(jdkSerializer).build();
.newSerializationContext()
.key(jdkSerializer)
.value(jdkSerializer)
.hashKey(jdkSerializer)
.hashValue(jdkSerializer)
.build();
return new ReactiveRedisTemplate<>(reactiveRedisConnectionFactory, serializationContext);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -134,9 +134,9 @@ class NoSuchBeanDefinitionFailureAnalyzer extends AbstractInjectionFailureAnalyz
}
String[] beanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.beanFactory, type);
return Arrays.stream(beanNames)
.map((beanName) -> new UserConfigurationResult(getFactoryMethodMetadata(beanName),
this.beanFactory.getBean(beanName).equals(null)))
.toList();
.map((beanName) -> new UserConfigurationResult(getFactoryMethodMetadata(beanName),
this.beanFactory.getBean(beanName).equals(null)))
.toList();
}
private MethodMetadata getFactoryMethodMetadata(String beanName) {
@@ -150,8 +150,8 @@ class NoSuchBeanDefinitionFailureAnalyzer extends AbstractInjectionFailureAnalyz
private void collectReportedConditionOutcomes(NoSuchBeanDefinitionException cause,
List<AutoConfigurationResult> results) {
this.report.getConditionAndOutcomesBySource()
.forEach((source, sourceOutcomes) -> collectReportedConditionOutcomes(cause, new Source(source),
sourceOutcomes, results));
.forEach((source, sourceOutcomes) -> collectReportedConditionOutcomes(cause, new Source(source),
sourceOutcomes, results));
}
private void collectReportedConditionOutcomes(NoSuchBeanDefinitionException cause, Source source,
@@ -224,9 +224,9 @@ class NoSuchBeanDefinitionFailureAnalyzer extends AbstractInjectionFailureAnalyz
private List<MethodMetadata> findBeanMethods(Source source, NoSuchBeanDefinitionException cause) {
try {
MetadataReader classMetadata = NoSuchBeanDefinitionFailureAnalyzer.this.metadataReaderFactory
.getMetadataReader(source.getClassName());
.getMetadataReader(source.getClassName());
Set<MethodMetadata> candidates = classMetadata.getAnnotationMetadata()
.getAnnotatedMethods(Bean.class.getName());
.getAnnotatedMethods(Bean.class.getName());
List<MethodMetadata> result = new ArrayList<>();
for (MethodMetadata candidate : candidates) {
if (isMatch(candidate, source, cause)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -112,7 +112,7 @@ public class EntityScanPackages {
Assert.notNull(packageNames, "PackageNames must not be null");
if (registry.containsBeanDefinition(BEAN)) {
EntityScanPackagesBeanDefinition beanDefinition = (EntityScanPackagesBeanDefinition) registry
.getBeanDefinition(BEAN);
.getBeanDefinition(BEAN);
beanDefinition.addPackageNames(packageNames);
}
else {
@@ -139,7 +139,7 @@ public class EntityScanPackages {
private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
AnnotationAttributes attributes = AnnotationAttributes
.fromMap(metadata.getAnnotationAttributes(EntityScan.class.getName()));
.fromMap(metadata.getAnnotationAttributes(EntityScan.class.getName()));
Set<String> packagesToScan = new LinkedHashSet<>();
for (String basePackage : attributes.getStringArray("basePackages")) {
String[] tokenized = StringUtils.tokenizeToStringArray(

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,7 +100,8 @@ class ElasticsearchRestClientConfigurations {
}
try {
return HttpHost.create(new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), uri.getPath(),
uri.getQuery(), uri.getFragment()).toString());
uri.getQuery(), uri.getFragment())
.toString());
}
catch (URISyntaxException ex) {
throw new IllegalStateException(ex);
@@ -156,16 +157,21 @@ class ElasticsearchRestClientConfigurations {
@Override
public void customize(HttpAsyncClientBuilder builder) {
builder.setDefaultCredentialsProvider(new PropertiesCredentialsProvider(this.properties));
map.from(this.properties::isSocketKeepAlive).to((keepAlive) -> builder
map.from(this.properties::isSocketKeepAlive)
.to((keepAlive) -> builder
.setDefaultIOReactorConfig(IOReactorConfig.custom().setSoKeepAlive(keepAlive).build()));
}
@Override
public void customize(RequestConfig.Builder builder) {
map.from(this.properties::getConnectionTimeout).whenNonNull().asInt(Duration::toMillis)
.to(builder::setConnectTimeout);
map.from(this.properties::getSocketTimeout).whenNonNull().asInt(Duration::toMillis)
.to(builder::setSocketTimeout);
map.from(this.properties::getConnectionTimeout)
.whenNonNull()
.asInt(Duration::toMillis)
.to(builder::setConnectTimeout);
map.from(this.properties::getSocketTimeout)
.whenNonNull()
.asInt(Duration::toMillis)
.to(builder::setSocketTimeout);
}
}
@@ -178,8 +184,11 @@ class ElasticsearchRestClientConfigurations {
properties.getPassword());
setCredentials(AuthScope.ANY, credentials);
}
properties.getUris().stream().map(this::toUri).filter(this::hasUserInfo)
.forEach(this::addUserInfoCredentials);
properties.getUris()
.stream()
.map(this::toUri)
.filter(this::hasUserInfo)
.forEach(this::addUserInfoCredentials);
}
private URI toUri(String uri) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -163,7 +163,7 @@ public class FlywayAutoConfiguration {
}
if (properties.getUser() != null && dataSource != null) {
DataSourceBuilder<?> builder = DataSourceBuilder.derivedFrom(dataSource)
.type(SimpleDriverDataSource.class);
.type(SimpleDriverDataSource.class);
applyCommonBuilderProperties(properties, builder);
return builder.build();
}
@@ -182,13 +182,16 @@ public class FlywayAutoConfiguration {
private void configureProperties(FluentConfiguration configuration, FlywayProperties properties) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
String[] locations = new LocationResolver(configuration.getDataSource())
.resolveLocations(properties.getLocations()).toArray(new String[0]);
.resolveLocations(properties.getLocations())
.toArray(new String[0]);
map.from(properties.isFailOnMissingLocations()).to(configuration::failOnMissingLocations);
map.from(locations).to(configuration::locations);
map.from(properties.getEncoding()).to(configuration::encoding);
map.from(properties.getConnectRetries()).to(configuration::connectRetries);
map.from(properties.getConnectRetriesInterval()).as(Duration::getSeconds).as(Long::intValue)
.to(configuration::connectRetriesInterval);
map.from(properties.getConnectRetriesInterval())
.as(Duration::getSeconds)
.as(Long::intValue)
.to(configuration::connectRetriesInterval);
map.from(properties.getLockRetryCount()).to(configuration::lockRetryCount);
map.from(properties.getDefaultSchema()).to(configuration::defaultSchema);
map.from(properties.getSchemas()).as(StringUtils::toStringArray).to(configuration::schemas);
@@ -204,8 +207,9 @@ public class FlywayAutoConfiguration {
map.from(properties.getPlaceholderSeparator()).to(configuration::placeholderSeparator);
map.from(properties.isPlaceholderReplacement()).to(configuration::placeholderReplacement);
map.from(properties.getSqlMigrationPrefix()).to(configuration::sqlMigrationPrefix);
map.from(properties.getSqlMigrationSuffixes()).as(StringUtils::toStringArray)
.to(configuration::sqlMigrationSuffixes);
map.from(properties.getSqlMigrationSuffixes())
.as(StringUtils::toStringArray)
.to(configuration::sqlMigrationSuffixes);
map.from(properties.getSqlMigrationSeparator()).to(configuration::sqlMigrationSeparator);
map.from(properties.getRepeatableSqlMigrationPrefix()).to(configuration::repeatableSqlMigrationPrefix);
map.from(properties.getTarget()).to(configuration::target);
@@ -219,13 +223,14 @@ public class FlywayAutoConfiguration {
map.from(properties.isSkipDefaultResolvers()).to(configuration::skipDefaultResolvers);
map.from(properties.isValidateMigrationNaming()).to(configuration::validateMigrationNaming);
map.from(properties.isValidateOnMigrate()).to(configuration::validateOnMigrate);
map.from(properties.getInitSqls()).whenNot(CollectionUtils::isEmpty)
.as((initSqls) -> StringUtils.collectionToDelimitedString(initSqls, "\n"))
.to(configuration::initSql);
map.from(properties.getInitSqls())
.whenNot(CollectionUtils::isEmpty)
.as((initSqls) -> StringUtils.collectionToDelimitedString(initSqls, "\n"))
.to(configuration::initSql);
map.from(properties.getScriptPlaceholderPrefix())
.to((prefix) -> configuration.scriptPlaceholderPrefix(prefix));
.to((prefix) -> configuration.scriptPlaceholderPrefix(prefix));
map.from(properties.getScriptPlaceholderSuffix())
.to((suffix) -> configuration.scriptPlaceholderSuffix(suffix));
.to((suffix) -> configuration.scriptPlaceholderSuffix(suffix));
// Flyway Teams properties
map.from(properties.getBatch()).to(configuration::batch);
map.from(properties.getDryRunOutput()).to(configuration::dryRunOutput);
@@ -240,19 +245,22 @@ public class FlywayAutoConfiguration {
map.from(properties.getKerberosConfigFile()).to(configuration::kerberosConfigFile);
map.from(properties.getOracleKerberosCacheFile()).to(configuration::oracleKerberosCacheFile);
map.from(properties.getOutputQueryResults()).to(configuration::outputQueryResults);
map.from(properties.getSqlServerKerberosLoginFile()).whenNonNull()
.to((sqlServerKerberosLoginFile) -> configureSqlServerKerberosLoginFile(configuration,
sqlServerKerberosLoginFile));
map.from(properties.getSqlServerKerberosLoginFile())
.whenNonNull()
.to((sqlServerKerberosLoginFile) -> configureSqlServerKerberosLoginFile(configuration,
sqlServerKerberosLoginFile));
map.from(properties.getSkipExecutingMigrations()).to(configuration::skipExecutingMigrations);
map.from(properties.getIgnoreMigrationPatterns()).whenNot(List::isEmpty)
.as((patterns) -> patterns.toArray(new String[0])).to(configuration::ignoreMigrationPatterns);
map.from(properties.getIgnoreMigrationPatterns())
.whenNot(List::isEmpty)
.as((patterns) -> patterns.toArray(new String[0]))
.to(configuration::ignoreMigrationPatterns);
map.from(properties.getDetectEncoding()).to(configuration::detectEncoding);
}
private void configureSqlServerKerberosLoginFile(FluentConfiguration configuration,
String sqlServerKerberosLoginFile) {
SQLServerConfigurationExtension sqlServerConfigurationExtension = configuration.getPluginRegister()
.getPlugin(SQLServerConfigurationExtension.class);
.getPlugin(SQLServerConfigurationExtension.class);
Assert.state(sqlServerConfigurationExtension != null, "Flyway SQL Server extension missing");
sqlServerConfigurationExtension.setKerberosLoginFile(sqlServerKerberosLoginFile);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,8 +42,11 @@ class FlywaySchemaManagementProvider implements SchemaManagementProvider {
@Override
public SchemaManagement getSchemaManagement(DataSource dataSource) {
return StreamSupport.stream(this.flywayInstances.spliterator(), false)
.map((flyway) -> flyway.getConfiguration().getDataSource()).filter(dataSource::equals).findFirst()
.map((managedDataSource) -> SchemaManagement.MANAGED).orElse(SchemaManagement.UNMANAGED);
.map((flyway) -> flyway.getConfiguration().getDataSource())
.filter(dataSource::equals)
.findFirst()
.map((managedDataSource) -> SchemaManagement.MANAGED)
.orElse(SchemaManagement.UNMANAGED);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -95,11 +95,13 @@ class NativeImageResourceProvider implements ResourceProvider {
}
ensureInitialized();
Predicate<LocatedResource> matchesPrefixAndSuffixes = (locatedResource) -> StringUtils
.startsAndEndsWith(locatedResource.resource.getFilename(), prefix, suffixes);
.startsAndEndsWith(locatedResource.resource.getFilename(), prefix, suffixes);
List<LoadableResource> result = new ArrayList<>();
result.addAll(this.scanner.getResources(prefix, suffixes));
this.locatedResources.stream().filter(matchesPrefixAndSuffixes).map(this::asClassPathResource)
.forEach(result::add);
this.locatedResources.stream()
.filter(matchesPrefixAndSuffixes)
.map(this::asClassPathResource)
.forEach(result::add);
return result;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ class ResourceProviderCustomizerBeanRegistrationAotProcessor implements BeanRegi
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
if (registeredBean.getBeanClass().equals(ResourceProviderCustomizer.class)) {
return BeanRegistrationAotContribution
.withCustomCodeFragments((codeFragments) -> new AotContribution(codeFragments, registeredBean));
.withCustomCodeFragments((codeFragments) -> new AotContribution(codeFragments, registeredBean));
}
return null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,9 +60,9 @@ class DefaultGraphQlSchemaCondition extends SpringBootCondition implements Confi
ConditionMessage.Builder message = ConditionMessage.forCondition(ConditionalOnGraphQlSchema.class);
Binder binder = Binder.get(context.getEnvironment());
GraphQlProperties.Schema schema = binder.bind("spring.graphql.schema", GraphQlProperties.Schema.class)
.orElse(new GraphQlProperties.Schema());
.orElse(new GraphQlProperties.Schema());
ResourcePatternResolver resourcePatternResolver = ResourcePatternUtils
.getResourcePatternResolver(context.getResourceLoader());
.getResourcePatternResolver(context.getResourceLoader());
List<Resource> schemaResources = resolveSchemaResources(resourcePatternResolver, schema.getLocations(),
schema.getFileExtensions());
if (!schemaResources.isEmpty()) {
@@ -70,8 +70,8 @@ class DefaultGraphQlSchemaCondition extends SpringBootCondition implements Confi
messages.add(message.found("schema", "schemas").items(ConditionMessage.Style.QUOTE, schemaResources));
}
else {
messages.add(message.didNotFind("schema files in locations").items(ConditionMessage.Style.QUOTE,
Arrays.asList(schema.getLocations())));
messages.add(message.didNotFind("schema files in locations")
.items(ConditionMessage.Style.QUOTE, Arrays.asList(schema.getLocations())));
}
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
String[] customizerBeans = beanFactory.getBeanNamesForType(GraphQlSourceBuilderCustomizer.class, false, false);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -87,9 +87,10 @@ public class GraphQlAutoConfiguration {
Resource[] schemaResources = resolveSchemaResources(resourcePatternResolver, schemaLocations,
properties.getSchema().getFileExtensions());
GraphQlSource.SchemaResourceBuilder builder = GraphQlSource.schemaResourceBuilder()
.schemaResources(schemaResources).exceptionResolvers(exceptionResolvers.orderedStream().toList())
.subscriptionExceptionResolvers(subscriptionExceptionResolvers.orderedStream().toList())
.instrumentation(instrumentations.orderedStream().toList());
.schemaResources(schemaResources)
.exceptionResolvers(exceptionResolvers.orderedStream().toList())
.subscriptionExceptionResolvers(subscriptionExceptionResolvers.orderedStream().toList())
.instrumentation(instrumentations.orderedStream().toList());
if (!properties.getSchema().getIntrospection().isEnabled()) {
builder.configureRuntimeWiring(this::enableIntrospection);
}
@@ -143,7 +144,7 @@ public class GraphQlAutoConfiguration {
public AnnotatedControllerConfigurer annotatedControllerConfigurer() {
AnnotatedControllerConfigurer controllerConfigurer = new AnnotatedControllerConfigurer();
controllerConfigurer
.addFormatterRegistrar((registry) -> ApplicationConversionService.addBeans(registry, this.beanFactory));
.addFormatterRegistrar((registry) -> ApplicationConversionService.addBeans(registry, this.beanFactory));
return controllerConfigurer;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,8 +100,9 @@ public class GraphQlProperties {
}
private String[] appendSlashIfNecessary(String[] locations) {
return Arrays.stream(locations).map((location) -> location.endsWith("/") ? location : location + "/")
.toArray(String[]::new);
return Arrays.stream(locations)
.map((location) -> location.endsWith("/") ? location : location + "/")
.toArray(String[]::new);
}
public Introspection getIntrospection() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -87,7 +87,8 @@ public class GraphQlWebFluxAutoConfiguration {
@SuppressWarnings("removal")
private static final RequestPredicate SUPPORTS_MEDIATYPES = accept(MediaType.APPLICATION_GRAPHQL_RESPONSE,
MediaType.APPLICATION_JSON, MediaType.APPLICATION_GRAPHQL).and(contentType(MediaType.APPLICATION_JSON));
MediaType.APPLICATION_JSON, MediaType.APPLICATION_GRAPHQL)
.and(contentType(MediaType.APPLICATION_JSON));
private static final Log logger = LogFactory.getLog(GraphQlWebFluxAutoConfiguration.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -114,7 +114,7 @@ public class GraphQlWebMvcAutoConfiguration {
RouterFunctions.Builder builder = RouterFunctions.route();
builder = builder.GET(path, this::onlyAllowPost);
builder = builder.POST(path, RequestPredicates.contentType(MediaType.APPLICATION_JSON)
.and(RequestPredicates.accept(SUPPORTED_MEDIA_TYPES)), httpHandler::handleRequest);
.and(RequestPredicates.accept(SUPPORTED_MEDIA_TYPES)), httpHandler::handleRequest);
if (properties.getGraphiql().isEnabled()) {
GraphiQlHandler graphiQLHandler = new GraphiQlHandler(path, properties.getWebsocket().getPath());
builder = builder.GET(properties.getGraphiql().getPath(), graphiQLHandler::handleRequest);
@@ -170,9 +170,12 @@ public class GraphQlWebMvcAutoConfiguration {
}
private GenericHttpMessageConverter<Object> getJsonConverter(HttpMessageConverters converters) {
return converters.getConverters().stream().filter(this::canReadJsonMap).findFirst()
.map(this::asGenericHttpMessageConverter)
.orElseThrow(() -> new IllegalStateException("No JSON converter"));
return converters.getConverters()
.stream()
.filter(this::canReadJsonMap)
.findFirst()
.map(this::asGenericHttpMessageConverter)
.orElseThrow(() -> new IllegalStateException("No JSON converter"));
}
private boolean canReadJsonMap(HttpMessageConverter<?> candidate) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ public class GsonAutoConfiguration {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(properties::getGenerateNonExecutableJson).toCall(builder::generateNonExecutableJson);
map.from(properties::getExcludeFieldsWithoutExposeAnnotation)
.toCall(builder::excludeFieldsWithoutExposeAnnotation);
.toCall(builder::excludeFieldsWithoutExposeAnnotation);
map.from(properties::getSerializeNulls).whenTrue().toCall(builder::serializeNulls);
map.from(properties::getEnableComplexMapKeySerialization).toCall(builder::enableComplexMapKeySerialization);
map.from(properties::getDisableInnerClassSerialization).toCall(builder::disableInnerClassSerialization);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@ class HazelcastClientConfigAvailableCondition extends HazelcastConfigResourceCon
ConditionOutcome configValidationOutcome = HazelcastClientValidation.clientConfigOutcome(context,
HAZELCAST_CONFIG_PROPERTY, startConditionMessage());
return (configValidationOutcome != null) ? configValidationOutcome : ConditionOutcome
.match(startConditionMessage().foundExactly("property " + HAZELCAST_CONFIG_PROPERTY));
.match(startConditionMessage().foundExactly("property " + HAZELCAST_CONFIG_PROPERTY));
}
return getResourceOutcome(context, metadata);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,8 +48,8 @@ public abstract class HazelcastConfigResourceCondition extends ResourceCondition
@Override
protected ConditionOutcome getResourceOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
if (System.getProperty(this.configSystemProperty) != null) {
return ConditionOutcome.match(
startConditionMessage().because("System property '" + this.configSystemProperty + "' is set."));
return ConditionOutcome
.match(startConditionMessage().because("System property '" + this.configSystemProperty + "' is set."));
}
return super.getResourceOutcome(context, metadata);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,8 +79,10 @@ public class CodecsAutoConfiguration {
PropertyMapper map = PropertyMapper.get();
CodecConfigurer.DefaultCodecs defaultCodecs = configurer.defaultCodecs();
defaultCodecs.enableLoggingRequestDetails(codecProperties.isLogRequestDetails());
map.from(codecProperties.getMaxInMemorySize()).whenNonNull().asInt(DataSize::toBytes)
.to(defaultCodecs::maxInMemorySize);
map.from(codecProperties.getMaxInMemorySize())
.whenNonNull()
.asInt(DataSize::toBytes)
.to(defaultCodecs::maxInMemorySize);
};
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -95,18 +95,20 @@ public class IntegrationAutoConfiguration {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(properties.getChannel().isAutoCreate()).to(integrationProperties::setChannelsAutoCreate);
map.from(properties.getChannel().getMaxUnicastSubscribers())
.to(integrationProperties::setChannelsMaxUnicastSubscribers);
.to(integrationProperties::setChannelsMaxUnicastSubscribers);
map.from(properties.getChannel().getMaxBroadcastSubscribers())
.to(integrationProperties::setChannelsMaxBroadcastSubscribers);
.to(integrationProperties::setChannelsMaxBroadcastSubscribers);
map.from(properties.getError().isRequireSubscribers())
.to(integrationProperties::setErrorChannelRequireSubscribers);
.to(integrationProperties::setErrorChannelRequireSubscribers);
map.from(properties.getError().isIgnoreFailures()).to(integrationProperties::setErrorChannelIgnoreFailures);
map.from(properties.getEndpoint().isThrowExceptionOnLateReply())
.to(integrationProperties::setMessagingTemplateThrowExceptionOnLateReply);
map.from(properties.getEndpoint().getReadOnlyHeaders()).as(StringUtils::toStringArray)
.to(integrationProperties::setReadOnlyHeaders);
map.from(properties.getEndpoint().getNoAutoStartup()).as(StringUtils::toStringArray)
.to(integrationProperties::setNoAutoStartupEndpoints);
.to(integrationProperties::setMessagingTemplateThrowExceptionOnLateReply);
map.from(properties.getEndpoint().getReadOnlyHeaders())
.as(StringUtils::toStringArray)
.to(integrationProperties::setReadOnlyHeaders);
map.from(properties.getEndpoint().getNoAutoStartup())
.as(StringUtils::toStringArray)
.to(integrationProperties::setNoAutoStartupEndpoints);
return integrationProperties;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,7 +60,8 @@ class IntegrationPropertiesEnvironmentPostProcessor implements EnvironmentPostPr
PropertiesPropertySourceLoader loader = new PropertiesPropertySourceLoader();
try {
OriginTrackedMapPropertySource propertyFileSource = (OriginTrackedMapPropertySource) loader
.load("META-INF/spring.integration.properties", resource).get(0);
.load("META-INF/spring.integration.properties", resource)
.get(0);
environment.getPropertySources().addLast(new IntegrationPropertiesPropertySource(propertyFileSource));
}
catch (IOException ex) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -361,8 +361,9 @@ public class JacksonAutoConfiguration {
}
private void registerPropertyNamingStrategyHints(ReflectionHints hints, Class<?> type) {
Stream.of(type.getDeclaredFields()).filter(this::isPropertyNamingStrategyField)
.forEach(hints::registerField);
Stream.of(type.getDeclaredFields())
.filter(this::isPropertyNamingStrategyField)
.forEach(hints::registerField);
}
private boolean isPropertyNamingStrategyField(Field candidate) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,14 +66,16 @@ class DataSourceBeanCreationFailureAnalyzer extends AbstractFailureAnalyzer<Data
StringBuilder action = new StringBuilder();
action.append(String.format("Consider the following:%n"));
if (EmbeddedDatabaseConnection.NONE == cause.getConnection()) {
action.append(String.format(
"\tIf you want an embedded database (H2, HSQL or Derby), please put it on the classpath.%n"));
action.append(String
.format("\tIf you want an embedded database (H2, HSQL or Derby), please put it on the classpath.%n"));
}
else {
action.append(String.format("\tReview the configuration of %s%n.", cause.getConnection()));
}
action.append("\tIf you have database settings to be loaded from a particular "
+ "profile you may need to activate it").append(getActiveProfiles());
action
.append("\tIf you have database settings to be loaded from a particular "
+ "profile you may need to activate it")
.append(getActiveProfiles());
return action.toString();
}

View File

@@ -120,8 +120,12 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
* this instance
*/
public DataSourceBuilder<?> initializeDataSourceBuilder() {
return DataSourceBuilder.create(getClassLoader()).type(getType()).driverClassName(determineDriverClassName())
.url(determineUrl()).username(determineUsername()).password(determinePassword());
return DataSourceBuilder.create(getClassLoader())
.type(getType())
.driverClassName(determineDriverClassName())
.url(determineUrl())
.username(determineUsername())
.password(determinePassword());
}
public boolean isGenerateUniqueName() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,8 @@ public class EmbeddedDataSourceConfiguration implements BeanClassLoaderAware {
@Bean(destroyMethod = "shutdown")
public EmbeddedDatabase dataSource(DataSourceProperties properties) {
return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseConnection.get(this.classLoader).getType())
.setName(properties.determineDatabaseName()).build();
.setName(properties.determineDatabaseName())
.build();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -91,12 +91,16 @@ public class JmsAutoConfiguration {
map.from(properties::getDefaultDestination).whenNonNull().to(template::setDefaultDestinationName);
map.from(properties::getDeliveryDelay).whenNonNull().as(Duration::toMillis).to(template::setDeliveryDelay);
map.from(properties::determineQosEnabled).to(template::setExplicitQosEnabled);
map.from(properties::getDeliveryMode).whenNonNull().as(DeliveryMode::getValue)
.to(template::setDeliveryMode);
map.from(properties::getDeliveryMode)
.whenNonNull()
.as(DeliveryMode::getValue)
.to(template::setDeliveryMode);
map.from(properties::getPriority).whenNonNull().to(template::setPriority);
map.from(properties::getTimeToLive).whenNonNull().as(Duration::toMillis).to(template::setTimeToLive);
map.from(properties::getReceiveTimeout).whenNonNull().as(Duration::toMillis)
.to(template::setReceiveTimeout);
map.from(properties::getReceiveTimeout)
.whenNonNull()
.as(Duration::toMillis)
.to(template::setReceiveTimeout);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ public class JmsPoolConnectionFactoryFactory {
pooledConnectionFactory.setBlockIfSessionPoolIsFull(this.properties.isBlockIfFull());
if (this.properties.getBlockIfFullTimeout() != null) {
pooledConnectionFactory
.setBlockIfSessionPoolIsFullTimeout(this.properties.getBlockIfFullTimeout().toMillis());
.setBlockIfSessionPoolIsFullTimeout(this.properties.getBlockIfFullTimeout().toMillis());
}
if (this.properties.getIdleTimeout() != null) {
pooledConnectionFactory.setConnectionIdleTimeout((int) this.properties.getIdleTimeout().toMillis());
@@ -56,7 +56,7 @@ public class JmsPoolConnectionFactoryFactory {
pooledConnectionFactory.setMaxSessionsPerConnection(this.properties.getMaxSessionsPerConnection());
if (this.properties.getTimeBetweenExpirationCheck() != null) {
pooledConnectionFactory
.setConnectionCheckInterval(this.properties.getTimeBetweenExpirationCheck().toMillis());
.setConnectionCheckInterval(this.properties.getTimeBetweenExpirationCheck().toMillis());
}
pooledConnectionFactory.setUseAnonymousProducers(this.properties.isUseAnonymousProducers());
return pooledConnectionFactory;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -77,7 +77,7 @@ class ArtemisConnectionFactoryConfiguration {
private ActiveMQConnectionFactory createConnectionFactory() {
return new ArtemisConnectionFactoryFactory(this.beanFactory, this.properties)
.createConnectionFactory(ActiveMQConnectionFactory.class);
.createConnectionFactory(ActiveMQConnectionFactory.class);
}
}
@@ -90,9 +90,9 @@ class ArtemisConnectionFactoryConfiguration {
@Bean(destroyMethod = "stop")
JmsPoolConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory, ArtemisProperties properties) {
ActiveMQConnectionFactory connectionFactory = new ArtemisConnectionFactoryFactory(beanFactory, properties)
.createConnectionFactory(ActiveMQConnectionFactory.class);
.createConnectionFactory(ActiveMQConnectionFactory.class);
return new JmsPoolConnectionFactoryFactory(properties.getPool())
.createPooledConnectionFactory(connectionFactory);
.createPooledConnectionFactory(connectionFactory);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -71,13 +71,14 @@ class ArtemisEmbeddedConfigurationFactory {
configuration.addAddressConfiguration(createAddressConfiguration("ExpiryQueue"));
configuration.addAddressSetting("#",
new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLQ"))
.setExpiryAddress(SimpleString.toSimpleString("ExpiryQueue")));
.setExpiryAddress(SimpleString.toSimpleString("ExpiryQueue")));
return configuration;
}
private CoreAddressConfiguration createAddressConfiguration(String name) {
return new CoreAddressConfiguration().setName(name).addRoutingType(RoutingType.ANYCAST).addQueueConfiguration(
new QueueConfiguration(name).setRoutingType(RoutingType.ANYCAST).setAddress(name));
return new CoreAddressConfiguration().setName(name)
.addRoutingType(RoutingType.ANYCAST)
.addQueueConfiguration(new QueueConfiguration(name).setRoutingType(RoutingType.ANYCAST).setAddress(name));
}
private String getDataDir() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,15 +66,16 @@ class ArtemisEmbeddedServerConfiguration {
ObjectProvider<ArtemisConfigurationCustomizer> configurationCustomizers) {
for (JMSQueueConfiguration queueConfiguration : jmsConfiguration.getQueueConfigurations()) {
String queueName = queueConfiguration.getName();
configuration.addAddressConfiguration(
new CoreAddressConfiguration().setName(queueName).addRoutingType(RoutingType.ANYCAST)
.addQueueConfiguration(new QueueConfiguration(queueName).setAddress(queueName)
.setFilterString(queueConfiguration.getSelector())
.setDurable(queueConfiguration.isDurable()).setRoutingType(RoutingType.ANYCAST)));
configuration.addAddressConfiguration(new CoreAddressConfiguration().setName(queueName)
.addRoutingType(RoutingType.ANYCAST)
.addQueueConfiguration(new QueueConfiguration(queueName).setAddress(queueName)
.setFilterString(queueConfiguration.getSelector())
.setDurable(queueConfiguration.isDurable())
.setRoutingType(RoutingType.ANYCAST)));
}
for (TopicConfiguration topicConfiguration : jmsConfiguration.getTopicConfigurations()) {
configuration.addAddressConfiguration(new CoreAddressConfiguration().setName(topicConfiguration.getName())
.addRoutingType(RoutingType.MULTICAST));
.addRoutingType(RoutingType.MULTICAST));
}
configurationCustomizers.orderedStream().forEach((customizer) -> customizer.customize(configuration));
EmbeddedActiveMQ embeddedActiveMq = new EmbeddedActiveMQ();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,14 +46,14 @@ class ArtemisXAConnectionFactoryConfiguration {
ConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory, ArtemisProperties properties,
XAConnectionFactoryWrapper wrapper) throws Exception {
return wrapper.wrapConnectionFactory(new ArtemisConnectionFactoryFactory(beanFactory, properties)
.createConnectionFactory(ActiveMQXAConnectionFactory.class));
.createConnectionFactory(ActiveMQXAConnectionFactory.class));
}
@Bean
ActiveMQXAConnectionFactory nonXaJmsConnectionFactory(ListableBeanFactory beanFactory,
ArtemisProperties properties) {
return new ArtemisConnectionFactoryFactory(beanFactory, properties)
.createConnectionFactory(ActiveMQXAConnectionFactory.class);
.createConnectionFactory(ActiveMQXAConnectionFactory.class);
}
}

View File

@@ -186,10 +186,13 @@ public class ConcurrentKafkaListenerContainerFactoryConfigurer {
map.from(properties::getNoPollThreshold).to(container::setNoPollThreshold);
map.from(properties.getIdleBetweenPolls()).as(Duration::toMillis).to(container::setIdleBetweenPolls);
map.from(properties::getIdleEventInterval).as(Duration::toMillis).to(container::setIdleEventInterval);
map.from(properties::getIdlePartitionEventInterval).as(Duration::toMillis)
.to(container::setIdlePartitionEventInterval);
map.from(properties::getMonitorInterval).as(Duration::getSeconds).as(Number::intValue)
.to(container::setMonitorInterval);
map.from(properties::getIdlePartitionEventInterval)
.as(Duration::toMillis)
.to(container::setIdlePartitionEventInterval);
map.from(properties::getMonitorInterval)
.as(Duration::getSeconds)
.as(Number::intValue)
.to(container::setMonitorInterval);
map.from(properties::getLogContainerConfig).to(container::setLogContainerConfig);
map.from(properties::isMissingTopicsFatal).to(container::setMissingTopicsFatal);
map.from(properties::isImmediateStop).to(container::setStopImmediate);

View File

@@ -81,7 +81,7 @@ class KafkaAnnotationDrivenConfiguration {
this.recordMessageConverter = recordMessageConverter.getIfUnique();
this.recordFilterStrategy = recordFilterStrategy.getIfUnique();
this.batchMessageConverter = batchMessageConverter
.getIfUnique(() -> new BatchMessagingMessageConverter(this.recordMessageConverter));
.getIfUnique(() -> new BatchMessagingMessageConverter(this.recordMessageConverter));
this.kafkaTemplate = kafkaTemplate.getIfUnique();
this.transactionManager = kafkaTransactionManager.getIfUnique();
this.rebalanceListener = rebalanceListener.getIfUnique();
@@ -114,7 +114,7 @@ class KafkaAnnotationDrivenConfiguration {
ObjectProvider<ConsumerFactory<Object, Object>> kafkaConsumerFactory) {
ConcurrentKafkaListenerContainerFactory<Object, Object> factory = new ConcurrentKafkaListenerContainerFactory<>();
configurer.configure(factory, kafkaConsumerFactory
.getIfAvailable(() -> new DefaultKafkaConsumerFactory<>(this.properties.buildConsumerProperties())));
.getIfAvailable(() -> new DefaultKafkaConsumerFactory<>(this.properties.buildConsumerProperties())));
return factory;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -152,8 +152,10 @@ public class KafkaAutoConfiguration {
public RetryTopicConfiguration kafkaRetryTopicConfiguration(KafkaTemplate<?, ?> kafkaTemplate) {
KafkaProperties.Retry.Topic retryTopic = this.properties.getRetry().getTopic();
RetryTopicConfigurationBuilder builder = RetryTopicConfigurationBuilder.newInstance()
.maxAttempts(retryTopic.getAttempts()).useSingleTopicForFixedDelays().suffixTopicsWithIndexValues()
.doNotAutoCreateRetryTopics();
.maxAttempts(retryTopic.getAttempts())
.useSingleTopicForFixedDelays()
.suffixTopicsWithIndexValues()
.doNotAutoCreateRetryTopics();
setBackOffPolicy(builder, retryTopic);
return builder.create(kafkaTemplate);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -428,21 +428,25 @@ public class KafkaProperties {
public Map<String, Object> buildProperties() {
Properties properties = new Properties();
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(this::getAutoCommitInterval).asInt(Duration::toMillis)
.to(properties.in(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG));
map.from(this::getAutoCommitInterval)
.asInt(Duration::toMillis)
.to(properties.in(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG));
map.from(this::getAutoOffsetReset).to(properties.in(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG));
map.from(this::getBootstrapServers).to(properties.in(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG));
map.from(this::getClientId).to(properties.in(ConsumerConfig.CLIENT_ID_CONFIG));
map.from(this::getEnableAutoCommit).to(properties.in(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG));
map.from(this::getFetchMaxWait).asInt(Duration::toMillis)
.to(properties.in(ConsumerConfig.FETCH_MAX_WAIT_MS_CONFIG));
map.from(this::getFetchMinSize).asInt(DataSize::toBytes)
.to(properties.in(ConsumerConfig.FETCH_MIN_BYTES_CONFIG));
map.from(this::getFetchMaxWait)
.asInt(Duration::toMillis)
.to(properties.in(ConsumerConfig.FETCH_MAX_WAIT_MS_CONFIG));
map.from(this::getFetchMinSize)
.asInt(DataSize::toBytes)
.to(properties.in(ConsumerConfig.FETCH_MIN_BYTES_CONFIG));
map.from(this::getGroupId).to(properties.in(ConsumerConfig.GROUP_ID_CONFIG));
map.from(this::getHeartbeatInterval).asInt(Duration::toMillis)
.to(properties.in(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG));
map.from(this::getHeartbeatInterval)
.asInt(Duration::toMillis)
.to(properties.in(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG));
map.from(() -> getIsolationLevel().name().toLowerCase(Locale.ROOT))
.to(properties.in(ConsumerConfig.ISOLATION_LEVEL_CONFIG));
.to(properties.in(ConsumerConfig.ISOLATION_LEVEL_CONFIG));
map.from(this::getKeyDeserializer).to(properties.in(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG));
map.from(this::getValueDeserializer).to(properties.in(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG));
map.from(this::getMaxPollRecords).to(properties.in(ConsumerConfig.MAX_POLL_RECORDS_CONFIG));
@@ -614,8 +618,9 @@ public class KafkaProperties {
map.from(this::getAcks).to(properties.in(ProducerConfig.ACKS_CONFIG));
map.from(this::getBatchSize).asInt(DataSize::toBytes).to(properties.in(ProducerConfig.BATCH_SIZE_CONFIG));
map.from(this::getBootstrapServers).to(properties.in(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG));
map.from(this::getBufferMemory).as(DataSize::toBytes)
.to(properties.in(ProducerConfig.BUFFER_MEMORY_CONFIG));
map.from(this::getBufferMemory)
.as(DataSize::toBytes)
.to(properties.in(ProducerConfig.BUFFER_MEMORY_CONFIG));
map.from(this::getClientId).to(properties.in(ProducerConfig.CLIENT_ID_CONFIG));
map.from(this::getCompressionType).to(properties.in(ProducerConfig.COMPRESSION_TYPE_CONFIG));
map.from(this::getKeySerializer).to(properties.in(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG));
@@ -827,8 +832,9 @@ public class KafkaProperties {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(this::getApplicationId).to(properties.in("application.id"));
map.from(this::getBootstrapServers).to(properties.in(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG));
map.from(this::getCacheMaxSizeBuffering).asInt(DataSize::toBytes)
.to(properties.in("cache.max.bytes.buffering"));
map.from(this::getCacheMaxSizeBuffering)
.asInt(DataSize::toBytes)
.to(properties.in("cache.max.bytes.buffering"));
map.from(this::getClientId).to(properties.in(CommonClientConfigs.CLIENT_ID_CONFIG));
map.from(this::getReplicationFactor).to(properties.in("replication.factor"));
map.from(this::getStateDir).to(properties.in("state.dir"));
@@ -1253,15 +1259,17 @@ public class KafkaProperties {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(this::getKeyPassword).to(properties.in(SslConfigs.SSL_KEY_PASSWORD_CONFIG));
map.from(this::getKeyStoreCertificateChain)
.to(properties.in(SslConfigs.SSL_KEYSTORE_CERTIFICATE_CHAIN_CONFIG));
.to(properties.in(SslConfigs.SSL_KEYSTORE_CERTIFICATE_CHAIN_CONFIG));
map.from(this::getKeyStoreKey).to(properties.in(SslConfigs.SSL_KEYSTORE_KEY_CONFIG));
map.from(this::getKeyStoreLocation).as(this::resourceToPath)
.to(properties.in(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG));
map.from(this::getKeyStoreLocation)
.as(this::resourceToPath)
.to(properties.in(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG));
map.from(this::getKeyStorePassword).to(properties.in(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG));
map.from(this::getKeyStoreType).to(properties.in(SslConfigs.SSL_KEYSTORE_TYPE_CONFIG));
map.from(this::getTrustStoreCertificates).to(properties.in(SslConfigs.SSL_TRUSTSTORE_CERTIFICATES_CONFIG));
map.from(this::getTrustStoreLocation).as(this::resourceToPath)
.to(properties.in(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG));
map.from(this::getTrustStoreLocation)
.as(this::resourceToPath)
.to(properties.in(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG));
map.from(this::getTrustStorePassword).to(properties.in(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG));
map.from(this::getTrustStoreType).to(properties.in(SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG));
map.from(this::getProtocol).to(properties.in(SslConfigs.SSL_PROTOCOL_CONFIG));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,8 +58,8 @@ public class LdapAutoConfiguration {
propertyMapper.from(properties.getAnonymousReadOnly()).to(source::setAnonymousReadOnly);
propertyMapper.from(properties.getBase()).to(source::setBase);
propertyMapper.from(properties.determineUrls(environment)).to(source::setUrls);
propertyMapper.from(properties.getBaseEnvironment()).to(
(baseEnvironment) -> source.setBaseEnvironmentProperties(Collections.unmodifiableMap(baseEnvironment)));
propertyMapper.from(properties.getBaseEnvironment())
.to((baseEnvironment) -> source.setBaseEnvironmentProperties(Collections.unmodifiableMap(baseEnvironment)));
return source;
}
@@ -70,10 +70,10 @@ public class LdapAutoConfiguration {
PropertyMapper propertyMapper = PropertyMapper.get().alwaysApplyingWhenNonNull();
LdapTemplate ldapTemplate = new LdapTemplate(contextSource);
propertyMapper.from(template.isIgnorePartialResultException())
.to(ldapTemplate::setIgnorePartialResultException);
.to(ldapTemplate::setIgnorePartialResultException);
propertyMapper.from(template.isIgnoreNameNotFoundException()).to(ldapTemplate::setIgnoreNameNotFoundException);
propertyMapper.from(template.isIgnoreSizeLimitExceededException())
.to(ldapTemplate::setIgnoreSizeLimitExceededException);
.to(ldapTemplate::setIgnoreSizeLimitExceededException);
return ldapTemplate;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -186,8 +186,10 @@ public class EmbeddedLdapAutoConfiguration {
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
Builder message = ConditionMessage.forCondition("Embedded LDAP");
Environment environment = context.getEnvironment();
if (environment != null && !Binder.get(environment).bind("spring.ldap.embedded.base-dn", STRING_LIST)
.orElseGet(Collections::emptyList).isEmpty()) {
if (environment != null && !Binder.get(environment)
.bind("spring.ldap.embedded.base-dn", STRING_LIST)
.orElseGet(Collections::emptyList)
.isEmpty()) {
return ConditionOutcome.match(message.because("Found base-dn property"));
}
return ConditionOutcome.noMatch(message.because("No base-dn property found"));
@@ -220,8 +222,8 @@ public class EmbeddedLdapAutoConfiguration {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
hints.resources().registerPatternIfPresent(classLoader, "schema.ldif",
(hint) -> hint.includes("schema.ldif"));
hints.resources()
.registerPatternIfPresent(classLoader, "schema.ldif", (hint) -> hint.includes("schema.ldif"));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -135,7 +135,7 @@ public class LiquibaseAutoConfiguration {
}
if (properties.getUser() != null && dataSource != null) {
DataSourceBuilder<?> builder = DataSourceBuilder.derivedFrom(dataSource)
.type(SimpleDriverDataSource.class);
.type(SimpleDriverDataSource.class);
applyCommonBuilderProperties(properties, builder);
return builder.build();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,9 +42,12 @@ class LiquibaseSchemaManagementProvider implements SchemaManagementProvider {
@Override
public SchemaManagement getSchemaManagement(DataSource dataSource) {
return StreamSupport.stream(this.liquibaseInstances.spliterator(), false).map(SpringLiquibase::getDataSource)
.filter(dataSource::equals).findFirst().map((managedDataSource) -> SchemaManagement.MANAGED)
.orElse(SchemaManagement.UNMANAGED);
return StreamSupport.stream(this.liquibaseInstances.spliterator(), false)
.map(SpringLiquibase::getDataSource)
.filter(dataSource::equals)
.findFirst()
.map((managedDataSource) -> SchemaManagement.MANAGED)
.orElse(SchemaManagement.UNMANAGED);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ class ConditionEvaluationReportLoggingProcessor implements BeanFactoryInitializa
private void logConditionEvaluationReport(ConfigurableListableBeanFactory beanFactory) {
new ConditionEvaluationReportLogger(LogLevel.DEBUG, () -> ConditionEvaluationReport.get(beanFactory))
.logReport(false);
.logReport(false);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,8 +70,10 @@ public class ConditionEvaluationReportMessage {
private void logPositiveMatches(StringBuilder message, Map<String, ConditionAndOutcomes> shortOutcomes) {
message.append(String.format("Positive matches:%n"));
message.append(String.format("-----------------%n"));
List<Entry<String, ConditionAndOutcomes>> matched = shortOutcomes.entrySet().stream()
.filter((entry) -> entry.getValue().isFullMatch()).toList();
List<Entry<String, ConditionAndOutcomes>> matched = shortOutcomes.entrySet()
.stream()
.filter((entry) -> entry.getValue().isFullMatch())
.toList();
if (matched.isEmpty()) {
message.append(String.format("%n None%n"));
}
@@ -84,8 +86,10 @@ public class ConditionEvaluationReportMessage {
private void logNegativeMatches(StringBuilder message, Map<String, ConditionAndOutcomes> shortOutcomes) {
message.append(String.format("Negative matches:%n"));
message.append(String.format("-----------------%n"));
List<Entry<String, ConditionAndOutcomes>> nonMatched = shortOutcomes.entrySet().stream()
.filter((entry) -> !entry.getValue().isFullMatch()).toList();
List<Entry<String, ConditionAndOutcomes>> nonMatched = shortOutcomes.entrySet()
.stream()
.filter((entry) -> !entry.getValue().isFullMatch())
.toList();
if (nonMatched.isEmpty()) {
message.append(String.format("%n None%n"));
}
@@ -130,8 +134,8 @@ public class ConditionEvaluationReportMessage {
for (String shortName : shortNames) {
List<String> fullyQualifiedNames = map.get(shortName);
if (fullyQualifiedNames.size() > 1) {
fullyQualifiedNames.forEach(
(fullyQualifiedName) -> result.put(fullyQualifiedName, outcomes.get(fullyQualifiedName)));
fullyQualifiedNames
.forEach((fullyQualifiedName) -> result.put(fullyQualifiedName, outcomes.get(fullyQualifiedName)));
}
else {
result.put(shortName, outcomes.get(fullyQualifiedNames.get(0)));
@@ -142,8 +146,8 @@ public class ConditionEvaluationReportMessage {
private MultiValueMap<String, String> mapToFullyQualifiedNames(Set<String> keySet) {
LinkedMultiValueMap<String, String> map = new LinkedMultiValueMap<>();
keySet.forEach(
(fullyQualifiedName) -> map.add(ClassUtils.getShortName(fullyQualifiedName), fullyQualifiedName));
keySet
.forEach((fullyQualifiedName) -> map.add(ClassUtils.getShortName(fullyQualifiedName), fullyQualifiedName));
return map;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,8 +57,9 @@ public abstract class MongoClientFactorySupport<T> {
}
private MongoDriverInformation driverInformation() {
return MongoDriverInformation.builder(MongoDriverInformation.builder().build()).driverName("spring-boot")
.build();
return MongoDriverInformation.builder(MongoDriverInformation.builder().build())
.driverName("spring-boot")
.build();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -107,8 +107,8 @@ public class MongoReactiveAutoConfiguration {
if (!isStreamFactoryFactoryDefined(this.settings.getIfAvailable())) {
NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup();
this.eventLoopGroup = eventLoopGroup;
builder.streamFactoryFactory(
NettyStreamFactoryFactory.builder().eventLoopGroup(eventLoopGroup).build());
builder
.streamFactoryFactory(NettyStreamFactoryFactory.builder().eventLoopGroup(eventLoopGroup).build());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -84,8 +84,8 @@ public class Neo4jAutoConfiguration {
boolean hasKerberosTicket = StringUtils.hasText(kerberosTicket);
if (hasUsername && hasKerberosTicket) {
throw new IllegalStateException(String.format(
"Cannot specify both username ('%s') and kerberos ticket ('%s')", username, kerberosTicket));
throw new IllegalStateException(String
.format("Cannot specify both username ('%s') and kerberos ticket ('%s')", username, kerberosTicket));
}
if (hasUsername && hasPassword) {
return AuthTokens.basic(username, password, realm);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,8 +52,10 @@ class HibernateDefaultDdlAutoProvider implements SchemaManagementProvider {
@Override
public SchemaManagement getSchemaManagement(DataSource dataSource) {
return StreamSupport.stream(this.providers.spliterator(), false)
.map((provider) -> provider.getSchemaManagement(dataSource)).filter(SchemaManagement.MANAGED::equals)
.findFirst().orElse(SchemaManagement.UNMANAGED);
.map((provider) -> provider.getSchemaManagement(dataSource))
.filter(SchemaManagement.MANAGED::equals)
.findFirst()
.orElse(SchemaManagement.UNMANAGED);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -112,8 +112,8 @@ class HibernateJpaConfiguration extends JpaBaseConfiguration {
new SpringBeanContainer(beanFactory)));
}
if (physicalNamingStrategy != null || implicitNamingStrategy != null) {
customizers.add(
new NamingStrategiesHibernatePropertiesCustomizer(physicalNamingStrategy, implicitNamingStrategy));
customizers
.add(new NamingStrategiesHibernatePropertiesCustomizer(physicalNamingStrategy, implicitNamingStrategy));
}
customizers.addAll(hibernatePropertiesCustomizers);
return customizers;
@@ -127,9 +127,9 @@ class HibernateJpaConfiguration extends JpaBaseConfiguration {
@Override
protected Map<String, Object> getVendorProperties() {
Supplier<String> defaultDdlMode = () -> this.defaultDdlAutoProvider.getDefaultDdlAuto(getDataSource());
return new LinkedHashMap<>(this.hibernateProperties
.determineHibernateProperties(getProperties().getProperties(), new HibernateSettings()
.ddlAuto(defaultDdlMode).hibernatePropertiesCustomizers(this.hibernatePropertiesCustomizers)));
return new LinkedHashMap<>(this.hibernateProperties.determineHibernateProperties(
getProperties().getProperties(), new HibernateSettings().ddlAuto(defaultDdlMode)
.hibernatePropertiesCustomizers(this.hibernatePropertiesCustomizers)));
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -130,8 +130,12 @@ public abstract class JpaBaseConfiguration {
PersistenceManagedTypes persistenceManagedTypes) {
Map<String, Object> vendorProperties = getVendorProperties();
customizeVendorProperties(vendorProperties);
return factoryBuilder.dataSource(this.dataSource).managedTypes(persistenceManagedTypes)
.properties(vendorProperties).mappingResources(getMappingResources()).jta(isJta()).build();
return factoryBuilder.dataSource(this.dataSource)
.managedTypes(persistenceManagedTypes)
.properties(vendorProperties)
.mappingResources(getMappingResources())
.jta(isJta())
.build();
}
protected abstract AbstractJpaVendorAdapter createJpaVendorAdapter();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,8 +70,10 @@ class ConnectionFactoryBeanCreationFailureAnalyzer
else {
action.append(String.format("\tReview the configuration of %s%n.", cause.getEmbeddedDatabaseConnection()));
}
action.append("\tIf you have database settings to be loaded from a particular "
+ "profile you may need to activate it").append(getActiveProfiles());
action
.append("\tIf you have database settings to be loaded from a particular "
+ "profile you may need to activate it")
.append(getActiveProfiles());
return action.toString();
}

View File

@@ -58,13 +58,14 @@ abstract class ConnectionFactoryConfigurations {
List<ConnectionFactoryOptionsBuilderCustomizer> optionsCustomizers) {
try {
return org.springframework.boot.r2dbc.ConnectionFactoryBuilder
.withOptions(new ConnectionFactoryOptionsInitializer().initialize(properties,
() -> EmbeddedDatabaseConnection.get(classLoader)))
.configure((options) -> {
for (ConnectionFactoryOptionsBuilderCustomizer optionsCustomizer : optionsCustomizers) {
optionsCustomizer.customize(options);
}
}).build();
.withOptions(new ConnectionFactoryOptionsInitializer().initialize(properties,
() -> EmbeddedDatabaseConnection.get(classLoader)))
.configure((options) -> {
for (ConnectionFactoryOptionsBuilderCustomizer optionsCustomizer : optionsCustomizers) {
optionsCustomizer.customize(options);
}
})
.build();
}
catch (IllegalStateException ex) {
String message = ex.getMessage();
@@ -134,8 +135,8 @@ abstract class ConnectionFactoryConfigurations {
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
BindResult<Pool> pool = Binder.get(context.getEnvironment()).bind("spring.r2dbc.pool",
Bindable.of(Pool.class));
BindResult<Pool> pool = Binder.get(context.getEnvironment())
.bind("spring.r2dbc.pool", Bindable.of(Pool.class));
if (hasPoolUrl(context.getEnvironment())) {
if (pool.isBound()) {
throw new MultipleConnectionPoolConfigurationsException();

View File

@@ -109,7 +109,7 @@ public class RSocketServerAutoConfiguration {
RSocketServerCustomizer frameDecoderRSocketServerCustomizer(RSocketMessageHandler rSocketMessageHandler) {
return (server) -> {
if (rSocketMessageHandler.getRSocketStrategies()
.dataBufferFactory() instanceof NettyDataBufferFactory) {
.dataBufferFactory() instanceof NettyDataBufferFactory) {
server.payloadDecoder(PayloadDecoder.ZERO_COPY);
}
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,22 +40,25 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
public class ClientsConfiguredCondition extends SpringBootCondition {
private static final Bindable<Map<String, OAuth2ClientProperties.Registration>> STRING_REGISTRATION_MAP = Bindable
.mapOf(String.class, OAuth2ClientProperties.Registration.class);
.mapOf(String.class, OAuth2ClientProperties.Registration.class);
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
ConditionMessage.Builder message = ConditionMessage.forCondition("OAuth2 Clients Configured Condition");
Map<String, OAuth2ClientProperties.Registration> registrations = getRegistrations(context.getEnvironment());
if (!registrations.isEmpty()) {
return ConditionOutcome.match(message.foundExactly("registered clients " + registrations.values().stream()
.map(OAuth2ClientProperties.Registration::getClientId).collect(Collectors.joining(", "))));
return ConditionOutcome.match(message.foundExactly("registered clients " + registrations.values()
.stream()
.map(OAuth2ClientProperties.Registration::getClientId)
.collect(Collectors.joining(", "))));
}
return ConditionOutcome.noMatch(message.notAvailable("registered clients"));
}
private Map<String, OAuth2ClientProperties.Registration> getRegistrations(Environment environment) {
return Binder.get(environment).bind("spring.security.oauth2.client.registration", STRING_REGISTRATION_MAP)
.orElse(Collections.emptyMap());
return Binder.get(environment)
.bind("spring.security.oauth2.client.registration", STRING_REGISTRATION_MAP)
.orElse(Collections.emptyMap());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,8 +49,9 @@ public final class OAuth2ClientPropertiesRegistrationAdapter {
public static Map<String, ClientRegistration> getClientRegistrations(OAuth2ClientProperties properties) {
Map<String, ClientRegistration> clientRegistrations = new HashMap<>();
properties.getRegistration().forEach((key, value) -> clientRegistrations.put(key,
getClientRegistration(key, value, properties.getProvider())));
properties.getRegistration()
.forEach((key, value) -> clientRegistrations.put(key,
getClientRegistration(key, value, properties.getProvider())));
return clientRegistrations;
}
@@ -63,10 +64,12 @@ public final class OAuth2ClientPropertiesRegistrationAdapter {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(properties::getClientId).to(builder::clientId);
map.from(properties::getClientSecret).to(builder::clientSecret);
map.from(properties::getClientAuthenticationMethod).as(ClientAuthenticationMethod::new)
.to(builder::clientAuthenticationMethod);
map.from(properties::getAuthorizationGrantType).as(AuthorizationGrantType::new)
.to(builder::authorizationGrantType);
map.from(properties::getClientAuthenticationMethod)
.as(ClientAuthenticationMethod::new)
.to(builder::clientAuthenticationMethod);
map.from(properties::getAuthorizationGrantType)
.as(AuthorizationGrantType::new)
.to(builder::authorizationGrantType);
map.from(properties::getRedirectUri).to(builder::redirectUri);
map.from(properties::getScope).as(StringUtils::toStringArray).to(builder::scope);
map.from(properties::getClientName).to(builder::clientName);
@@ -112,8 +115,9 @@ public final class OAuth2ClientPropertiesRegistrationAdapter {
map.from(provider::getAuthorizationUri).to(builder::authorizationUri);
map.from(provider::getTokenUri).to(builder::tokenUri);
map.from(provider::getUserInfoUri).to(builder::userInfoUri);
map.from(provider::getUserInfoAuthenticationMethod).as(AuthenticationMethod::new)
.to(builder::userInfoAuthenticationMethod);
map.from(provider::getUserInfoAuthenticationMethod)
.as(AuthenticationMethod::new)
.to(builder::userInfoAuthenticationMethod);
map.from(provider::getJwkSetUri).to(builder::jwkSetUri);
map.from(provider::getUserNameAttribute).to(builder::userNameAttributeName);
return builder;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ public class KeyValueCondition extends SpringBootCondition {
ConditionMessage.Builder message = ConditionMessage.forCondition("Public Key Value Condition");
Environment environment = context.getEnvironment();
String publicKeyLocation = environment
.getProperty("spring.security.oauth2.resourceserver.jwt.public-key-location");
.getProperty("spring.security.oauth2.resourceserver.jwt.public-key-location");
if (!StringUtils.hasText(publicKeyLocation)) {
return ConditionOutcome.noMatch(message.didNotFind("public-key-location property").atAll());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,7 +79,9 @@ class ReactiveOAuth2ResourceServerJwkConfiguration {
@ConditionalOnProperty(name = "spring.security.oauth2.resourceserver.jwt.jwk-set-uri")
ReactiveJwtDecoder jwtDecoder() {
NimbusReactiveJwtDecoder nimbusReactiveJwtDecoder = NimbusReactiveJwtDecoder
.withJwkSetUri(this.properties.getJwkSetUri()).jwsAlgorithms(this::jwsAlgorithms).build();
.withJwkSetUri(this.properties.getJwkSetUri())
.jwsAlgorithms(this::jwsAlgorithms)
.build();
String issuerUri = this.properties.getIssuerUri();
Supplier<OAuth2TokenValidator<Jwt>> defaultValidator = (issuerUri != null)
? () -> JwtValidators.createDefaultWithIssuer(issuerUri) : JwtValidators::createDefault;
@@ -110,9 +112,10 @@ class ReactiveOAuth2ResourceServerJwkConfiguration {
@Conditional(KeyValueCondition.class)
NimbusReactiveJwtDecoder jwtDecoderByPublicKeyValue() throws Exception {
RSAPublicKey publicKey = (RSAPublicKey) KeyFactory.getInstance("RSA")
.generatePublic(new X509EncodedKeySpec(getKeySpec(this.properties.readPublicKey())));
.generatePublic(new X509EncodedKeySpec(getKeySpec(this.properties.readPublicKey())));
NimbusReactiveJwtDecoder jwtDecoder = NimbusReactiveJwtDecoder.withPublicKey(publicKey)
.signatureAlgorithm(SignatureAlgorithm.from(exactlyOneAlgorithm())).build();
.signatureAlgorithm(SignatureAlgorithm.from(exactlyOneAlgorithm()))
.build();
jwtDecoder.setJwtValidator(getValidators(JwtValidators::createDefault));
return jwtDecoder;
}
@@ -138,7 +141,7 @@ class ReactiveOAuth2ResourceServerJwkConfiguration {
SupplierReactiveJwtDecoder jwtDecoderByIssuerUri() {
return new SupplierReactiveJwtDecoder(() -> {
NimbusReactiveJwtDecoder jwtDecoder = (NimbusReactiveJwtDecoder) ReactiveJwtDecoders
.fromIssuerLocation(this.properties.getIssuerUri());
.fromIssuerLocation(this.properties.getIssuerUri());
jwtDecoder.setJwtValidator(
getValidators(() -> JwtValidators.createDefaultWithIssuer(this.properties.getIssuerUri())));
return jwtDecoder;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,7 +79,8 @@ class OAuth2ResourceServerJwtConfiguration {
@ConditionalOnProperty(name = "spring.security.oauth2.resourceserver.jwt.jwk-set-uri")
JwtDecoder jwtDecoderByJwkKeySetUri() {
NimbusJwtDecoder nimbusJwtDecoder = NimbusJwtDecoder.withJwkSetUri(this.properties.getJwkSetUri())
.jwsAlgorithms(this::jwsAlgorithms).build();
.jwsAlgorithms(this::jwsAlgorithms)
.build();
String issuerUri = this.properties.getIssuerUri();
Supplier<OAuth2TokenValidator<Jwt>> defaultValidator = (issuerUri != null)
? () -> JwtValidators.createDefaultWithIssuer(issuerUri) : JwtValidators::createDefault;
@@ -110,9 +111,10 @@ class OAuth2ResourceServerJwtConfiguration {
@Conditional(KeyValueCondition.class)
JwtDecoder jwtDecoderByPublicKeyValue() throws Exception {
RSAPublicKey publicKey = (RSAPublicKey) KeyFactory.getInstance("RSA")
.generatePublic(new X509EncodedKeySpec(getKeySpec(this.properties.readPublicKey())));
.generatePublic(new X509EncodedKeySpec(getKeySpec(this.properties.readPublicKey())));
NimbusJwtDecoder jwtDecoder = NimbusJwtDecoder.withPublicKey(publicKey)
.signatureAlgorithm(SignatureAlgorithm.from(exactlyOneAlgorithm())).build();
.signatureAlgorithm(SignatureAlgorithm.from(exactlyOneAlgorithm()))
.build();
jwtDecoder.setJwtValidator(getValidators(JwtValidators::createDefault));
return jwtDecoder;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ public class RSocketSecurityAutoConfiguration {
@Bean
RSocketMessageHandlerCustomizer rSocketAuthenticationPrincipalMessageHandlerCustomizer() {
return (messageHandler) -> messageHandler.getArgumentResolverConfigurer()
.addCustomResolver(new AuthenticationPrincipalArgumentResolver());
.addCustomResolver(new AuthenticationPrincipalArgumentResolver());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,8 +62,11 @@ class Saml2RelyingPartyRegistrationConfiguration {
@Bean
RelyingPartyRegistrationRepository relyingPartyRegistrationRepository(Saml2RelyingPartyProperties properties) {
List<RelyingPartyRegistration> registrations = properties.getRegistration().entrySet().stream()
.map(this::asRegistration).toList();
List<RelyingPartyRegistration> registrations = properties.getRegistration()
.entrySet()
.stream()
.map(this::asRegistration)
.toList();
return new InMemoryRelyingPartyRegistrationRepository(registrations);
}
@@ -73,19 +76,30 @@ class Saml2RelyingPartyRegistrationConfiguration {
private RelyingPartyRegistration asRegistration(String id, Registration properties) {
boolean usingMetadata = StringUtils.hasText(properties.getAssertingparty().getMetadataUri());
Builder builder = (usingMetadata) ? RelyingPartyRegistrations
.fromMetadataLocation(properties.getAssertingparty().getMetadataUri()).registrationId(id)
Builder builder = (usingMetadata)
? RelyingPartyRegistrations.fromMetadataLocation(properties.getAssertingparty().getMetadataUri())
.registrationId(id)
: RelyingPartyRegistration.withRegistrationId(id);
builder.assertionConsumerServiceLocation(properties.getAcs().getLocation());
builder.assertionConsumerServiceBinding(properties.getAcs().getBinding());
builder.assertingPartyDetails(mapAssertingParty(properties.getAssertingparty(), usingMetadata));
builder.signingX509Credentials((credentials) -> properties.getSigning().getCredentials().stream()
.map(this::asSigningCredential).forEach(credentials::add));
builder.decryptionX509Credentials((credentials) -> properties.getDecryption().getCredentials().stream()
.map(this::asDecryptionCredential).forEach(credentials::add));
builder.assertingPartyDetails((details) -> details
.verificationX509Credentials((credentials) -> properties.getAssertingparty().getVerification()
.getCredentials().stream().map(this::asVerificationCredential).forEach(credentials::add)));
builder.signingX509Credentials((credentials) -> properties.getSigning()
.getCredentials()
.stream()
.map(this::asSigningCredential)
.forEach(credentials::add));
builder.decryptionX509Credentials((credentials) -> properties.getDecryption()
.getCredentials()
.stream()
.map(this::asDecryptionCredential)
.forEach(credentials::add));
builder.assertingPartyDetails(
(details) -> details.verificationX509Credentials((credentials) -> properties.getAssertingparty()
.getVerification()
.getCredentials()
.stream()
.map(this::asVerificationCredential)
.forEach(credentials::add)));
builder.singleLogoutServiceLocation(properties.getSinglelogout().getUrl());
builder.singleLogoutServiceResponseLocation(properties.getSinglelogout().getResponseUrl());
builder.singleLogoutServiceBinding(properties.getSinglelogout().getBinding());
@@ -103,8 +117,9 @@ class Saml2RelyingPartyRegistrationConfiguration {
map.from(assertingParty::getEntityId).to(details::entityId);
map.from(assertingParty.getSinglesignon()::getBinding).to(details::singleSignOnServiceBinding);
map.from(assertingParty.getSinglesignon()::getUrl).to(details::singleSignOnServiceLocation);
map.from(assertingParty.getSinglesignon()::isSignRequest).when((signRequest) -> !usingMetadata)
.to(details::wantAuthnRequestsSigned);
map.from(assertingParty.getSinglesignon()::isSignRequest)
.when((signRequest) -> !usingMetadata)
.to(details::wantAuthnRequestsSigned);
map.from(assertingParty.getSinglelogout()::getUrl).to(details::singleLogoutServiceLocation);
map.from(assertingParty.getSinglelogout()::getResponseUrl).to(details::singleLogoutServiceResponseLocation);
map.from(assertingParty.getSinglelogout()::getBinding).to(details::singleLogoutServiceBinding);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -69,9 +69,11 @@ public class SecurityFilterAutoConfiguration {
if (securityProperties.getFilter().getDispatcherTypes() == null) {
return null;
}
return securityProperties.getFilter().getDispatcherTypes().stream()
.map((type) -> DispatcherType.valueOf(type.name()))
.collect(Collectors.toCollection(() -> EnumSet.noneOf(DispatcherType.class)));
return securityProperties.getFilter()
.getDispatcherTypes()
.stream()
.map((type) -> DispatcherType.valueOf(type.name()))
.collect(Collectors.toCollection(() -> EnumSet.noneOf(DispatcherType.class)));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -140,8 +140,9 @@ public final class StaticResourceRequest {
}
private Stream<String> getPatterns(DispatcherServletPath dispatcherServletPath) {
return this.locations.stream().flatMap(StaticResourceLocation::getPatterns)
.map(dispatcherServletPath::getRelativePath);
return this.locations.stream()
.flatMap(StaticResourceLocation::getPatterns)
.map(dispatcherServletPath::getRelativePath);
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,9 +75,10 @@ public class UserDetailsServiceAutoConfiguration {
ObjectProvider<PasswordEncoder> passwordEncoder) {
SecurityProperties.User user = properties.getUser();
List<String> roles = user.getRoles();
return new InMemoryUserDetailsManager(
User.withUsername(user.getName()).password(getOrDeducePassword(user, passwordEncoder.getIfAvailable()))
.roles(StringUtils.toStringArray(roles)).build());
return new InMemoryUserDetailsManager(User.withUsername(user.getName())
.password(getOrDeducePassword(user, passwordEncoder.getIfAvailable()))
.roles(StringUtils.toStringArray(roles))
.build());
}
private String getOrDeducePassword(SecurityProperties.User user, PasswordEncoder encoder) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ class HazelcastSessionConfiguration {
return (sessionRepository) -> {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(sessionProperties.determineTimeout(() -> serverProperties.getServlet().getSession().getTimeout()))
.to(sessionRepository::setDefaultMaxInactiveInterval);
.to(sessionRepository::setDefaultMaxInactiveInterval);
map.from(hazelcastSessionProperties::getMapName).to(sessionRepository::setSessionMapName);
map.from(hazelcastSessionProperties::getFlushMode).to(sessionRepository::setFlushMode);
map.from(hazelcastSessionProperties::getSaveMode).to(sessionRepository::setSaveMode);

View File

@@ -73,7 +73,7 @@ class JdbcSessionConfiguration {
return (sessionRepository) -> {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(sessionProperties.determineTimeout(() -> serverProperties.getServlet().getSession().getTimeout()))
.to(sessionRepository::setDefaultMaxInactiveInterval);
.to(sessionRepository::setDefaultMaxInactiveInterval);
map.from(jdbcSessionProperties::getTableName).to(sessionRepository::setTableName);
map.from(jdbcSessionProperties::getFlushMode).to(sessionRepository::setFlushMode);
map.from(jdbcSessionProperties::getSaveMode).to(sessionRepository::setSaveMode);

Some files were not shown because too many files have changed in this diff Show More