Commit 49fa7027 authored by Phillip Webb's avatar Phillip Webb

Merge branch '1.5.x'

parents 7cf08be3 85504e74
......@@ -44,8 +44,8 @@ public class AuditAutoConfiguration {
private final AuditEventRepository auditEventRepository;
public AuditAutoConfiguration(
ObjectProvider<AuditEventRepository> auditEventRepositoryProvider) {
this.auditEventRepository = auditEventRepositoryProvider.getIfAvailable();
ObjectProvider<AuditEventRepository> auditEventRepository) {
this.auditEventRepository = auditEventRepository.getIfAvailable();
}
@Bean
......
......@@ -93,17 +93,16 @@ public class EndpointAutoConfiguration {
private final TraceRepository traceRepository;
public EndpointAutoConfiguration(
ObjectProvider<HealthAggregator> healthAggregatorProvider,
ObjectProvider<Map<String, HealthIndicator>> healthIndicatorsProvider,
ObjectProvider<List<InfoContributor>> infoContributorsProvider,
ObjectProvider<Collection<PublicMetrics>> publicMetricsProvider,
ObjectProvider<TraceRepository> traceRepositoryProvider) {
this.healthAggregator = healthAggregatorProvider.getIfAvailable();
this.healthIndicators = healthIndicatorsProvider.getIfAvailable();
this.infoContributors = infoContributorsProvider.getIfAvailable();
this.publicMetrics = publicMetricsProvider.getIfAvailable();
this.traceRepository = traceRepositoryProvider.getIfAvailable();
public EndpointAutoConfiguration(ObjectProvider<HealthAggregator> healthAggregator,
ObjectProvider<Map<String, HealthIndicator>> healthIndicators,
ObjectProvider<List<InfoContributor>> infoContributors,
ObjectProvider<Collection<PublicMetrics>> publicMetrics,
ObjectProvider<TraceRepository> traceRepository) {
this.healthAggregator = healthAggregator.getIfAvailable();
this.healthIndicators = healthIndicators.getIfAvailable();
this.infoContributors = infoContributors.getIfAvailable();
this.publicMetrics = publicMetrics.getIfAvailable();
this.traceRepository = traceRepository.getIfAvailable();
}
@Bean
......
......@@ -58,9 +58,9 @@ public class EndpointMBeanExportAutoConfiguration {
private final ObjectMapper objectMapper;
public EndpointMBeanExportAutoConfiguration(EndpointMBeanExportProperties properties,
ObjectProvider<ObjectMapper> objectMapperProvider) {
ObjectProvider<ObjectMapper> objectMapper) {
this.properties = properties;
this.objectMapper = objectMapperProvider.getIfAvailable();
this.objectMapper = objectMapper.getIfAvailable();
}
@Bean
......
......@@ -81,11 +81,11 @@ public class EndpointWebMvcManagementContextConfiguration {
HealthMvcEndpointProperties healthMvcEndpointProperties,
ManagementServerProperties managementServerProperties,
EndpointCorsProperties corsProperties,
ObjectProvider<List<EndpointHandlerMappingCustomizer>> mappingCustomizersProvider) {
ObjectProvider<List<EndpointHandlerMappingCustomizer>> mappingCustomizers) {
this.healthMvcEndpointProperties = healthMvcEndpointProperties;
this.managementServerProperties = managementServerProperties;
this.corsProperties = corsProperties;
List<EndpointHandlerMappingCustomizer> providedCustomizers = mappingCustomizersProvider
List<EndpointHandlerMappingCustomizer> providedCustomizers = mappingCustomizers
.getIfAvailable();
this.mappingCustomizers = providedCustomizers == null
? Collections.<EndpointHandlerMappingCustomizer>emptyList()
......
......@@ -186,14 +186,17 @@ public class HealthIndicatorAutoConfiguration {
private DataSourcePoolMetadataProvider poolMetadataProvider;
public DataSourcesHealthIndicatorConfiguration(
ObjectProvider<Map<String, DataSource>> dataSourcesProvider,
ObjectProvider<Collection<DataSourcePoolMetadataProvider>> metadataProvidersProvider) {
this.dataSources = filterDataSources(dataSourcesProvider.getIfAvailable());
this.metadataProviders = metadataProvidersProvider.getIfAvailable();
ObjectProvider<Map<String, DataSource>> dataSources,
ObjectProvider<Collection<DataSourcePoolMetadataProvider>> metadataProviders) {
this.dataSources = filterDataSources(dataSources.getIfAvailable());
this.metadataProviders = metadataProviders.getIfAvailable();
}
private static Map<String, DataSource> filterDataSources(
private Map<String, DataSource> filterDataSources(
Map<String, DataSource> candidates) {
if (candidates == null) {
return null;
}
Map<String, DataSource> dataSources = new LinkedHashMap<String, DataSource>();
for (Map.Entry<String, DataSource> entry : candidates.entrySet()) {
if (!(entry.getValue() instanceof AbstractRoutingDataSource)) {
......@@ -338,8 +341,8 @@ public class HealthIndicatorAutoConfiguration {
private final Map<String, JavaMailSenderImpl> mailSenders;
public MailHealthIndicatorConfiguration(
ObjectProvider<Map<String, JavaMailSenderImpl>> mailSendersProvider) {
this.mailSenders = mailSendersProvider.getIfAvailable();
ObjectProvider<Map<String, JavaMailSenderImpl>> mailSenders) {
this.mailSenders = mailSenders.getIfAvailable();
}
@Bean
......@@ -359,8 +362,8 @@ public class HealthIndicatorAutoConfiguration {
private final Map<String, ConnectionFactory> connectionFactories;
public JmsHealthIndicatorConfiguration(
ObjectProvider<Map<String, ConnectionFactory>> connectionFactoriesProvider) {
this.connectionFactories = connectionFactoriesProvider.getIfAvailable();
ObjectProvider<Map<String, ConnectionFactory>> connectionFactories) {
this.connectionFactories = connectionFactories.getIfAvailable();
}
@Bean
......
......@@ -100,9 +100,9 @@ public class ManagementWebSecurityAutoConfiguration {
@Bean
public IgnoredRequestCustomizer managementIgnoredRequestCustomizer(
ManagementServerProperties management,
ObjectProvider<ManagementContextResolver> contextResolverProvider) {
ObjectProvider<ManagementContextResolver> contextResolver) {
return new ManagementIgnoredRequestCustomizer(management,
contextResolverProvider.getIfAvailable());
contextResolver.getIfAvailable());
}
private class ManagementIgnoredRequestCustomizer implements IgnoredRequestCustomizer {
......@@ -133,22 +133,23 @@ public class ManagementWebSecurityAutoConfiguration {
protected static class ManagementSecurityPropertiesConfiguration
implements SecurityPrerequisite {
private final SecurityProperties security;
private final SecurityProperties securityProperties;
private final ManagementServerProperties management;
private final ManagementServerProperties managementServerProperties;
public ManagementSecurityPropertiesConfiguration(
ObjectProvider<SecurityProperties> securityProvider,
ObjectProvider<ManagementServerProperties> managementProvider) {
this.security = securityProvider.getIfAvailable();
this.management = managementProvider.getIfAvailable();
ObjectProvider<SecurityProperties> securityProperties,
ObjectProvider<ManagementServerProperties> managementServerProperties) {
this.securityProperties = securityProperties.getIfAvailable();
this.managementServerProperties = managementServerProperties.getIfAvailable();
}
@PostConstruct
public void init() {
if (this.management != null && this.security != null) {
this.security.getUser().getRole()
.addAll(this.management.getSecurity().getRoles());
if (this.managementServerProperties != null
&& this.securityProperties != null) {
this.securityProperties.getUser().getRole()
.addAll(this.managementServerProperties.getSecurity().getRoles());
}
}
......@@ -200,10 +201,10 @@ public class ManagementWebSecurityAutoConfiguration {
public ManagementWebSecurityConfigurerAdapter(SecurityProperties security,
ManagementServerProperties management,
ObjectProvider<ManagementContextResolver> contextResolverProvider) {
ObjectProvider<ManagementContextResolver> contextResolver) {
this.security = security;
this.management = management;
this.contextResolver = contextResolverProvider.getIfAvailable();
this.contextResolver = contextResolver.getIfAvailable();
}
@Override
......
......@@ -64,14 +64,14 @@ public class MetricExportAutoConfiguration {
private final Map<String, Exporter> exporters;
public MetricExportAutoConfiguration(MetricExportProperties properties,
ObjectProvider<MetricsEndpointMetricReader> endpointReaderProvider,
@ExportMetricReader ObjectProvider<List<MetricReader>> readersProvider,
@ExportMetricWriter ObjectProvider<Map<String, GaugeWriter>> writersProvider,
ObjectProvider<Map<String, Exporter>> exportersProvider) {
this.endpointReader = endpointReaderProvider.getIfAvailable();
this.readers = readersProvider.getIfAvailable();
this.writers = writersProvider.getIfAvailable();
this.exporters = exportersProvider.getIfAvailable();
ObjectProvider<MetricsEndpointMetricReader> endpointReader,
@ExportMetricReader ObjectProvider<List<MetricReader>> readers,
@ExportMetricWriter ObjectProvider<Map<String, GaugeWriter>> writers,
ObjectProvider<Map<String, Exporter>> exporters) {
this.endpointReader = endpointReader.getIfAvailable();
this.readers = readers.getIfAvailable();
this.writers = writers.getIfAvailable();
this.exporters = exporters.getIfAvailable();
}
@Bean
......
......@@ -73,8 +73,8 @@ public class PublicMetricsAutoConfiguration {
private final List<MetricReader> metricReaders;
public PublicMetricsAutoConfiguration(
@ExportMetricReader ObjectProvider<List<MetricReader>> metricReadersProvider) {
this.metricReaders = metricReadersProvider.getIfAvailable();
@ExportMetricReader ObjectProvider<List<MetricReader>> metricReaders) {
this.metricReaders = metricReaders.getIfAvailable();
}
@Bean
......
......@@ -54,10 +54,10 @@ public class TraceWebFilterAutoConfiguration {
public TraceWebFilterAutoConfiguration(TraceRepository traceRepository,
TraceProperties traceProperties,
ObjectProvider<ErrorAttributes> errorAttributesProvider) {
ObjectProvider<ErrorAttributes> errorAttributes) {
this.traceRepository = traceRepository;
this.traceProperties = traceProperties;
this.errorAttributes = errorAttributesProvider.getIfAvailable();
this.errorAttributes = errorAttributes.getIfAvailable();
}
@Bean
......
......@@ -110,8 +110,8 @@ public class EndpointMvcIntegrationTests {
private final List<HttpMessageConverter<?>> converters;
public Application(
ObjectProvider<List<HttpMessageConverter<?>>> convertersProvider) {
this.converters = convertersProvider.getIfAvailable();
ObjectProvider<List<HttpMessageConverter<?>>> converters) {
this.converters = converters.getIfAvailable();
}
@RequestMapping("/{name}/{env}/{bar}")
......
......@@ -24,7 +24,6 @@ import io.searchbox.client.JestClient;
import org.junit.After;
import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
import org.springframework.boot.actuate.health.CassandraHealthIndicator;
import org.springframework.boot.actuate.health.CompositeHealthIndicator;
......@@ -242,9 +241,8 @@ public class HealthIndicatorAutoConfigurationTests {
assertThat(beans).hasSize(1);
HealthIndicator bean = beans.values().iterator().next();
assertThat(bean).isExactlyInstanceOf(CompositeHealthIndicator.class);
Map<String, HealthIndicator> indicators = (Map<String, HealthIndicator>)
new DirectFieldAccessor(bean).getPropertyValue("indicators");
assertThat(indicators).hasSize(2);
assertThat(bean.health().getDetails()).containsOnlyKeys("dataSource",
"testDataSource");
}
@Test
......@@ -258,8 +256,8 @@ public class HealthIndicatorAutoConfigurationTests {
Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class);
assertThat(beans).hasSize(1);
assertThat(beans.values().iterator().next().getClass())
.isEqualTo(DataSourceHealthIndicator.class);
assertThat(beans.values().iterator().next())
.isExactlyInstanceOf(DataSourceHealthIndicator.class);
}
@Test
......
......@@ -60,9 +60,9 @@ public class SpringApplicationAdminJmxAutoConfiguration {
private final Environment environment;
public SpringApplicationAdminJmxAutoConfiguration(
ObjectProvider<MBeanExporter> mbeanExporterProvider,
ObjectProvider<MBeanExporter> mbeanExporter,
Environment environment) {
this.mbeanExporter = mbeanExporterProvider.getIfAvailable();
this.mbeanExporter = mbeanExporter.getIfAvailable();
this.environment = environment;
}
......
......@@ -72,9 +72,9 @@ public class BatchAutoConfiguration {
private final JobParametersConverter jobParametersConverter;
public BatchAutoConfiguration(BatchProperties properties,
ObjectProvider<JobParametersConverter> jobParametersConverterProvider) {
ObjectProvider<JobParametersConverter> jobParametersConverter) {
this.properties = properties;
this.jobParametersConverter = jobParametersConverterProvider.getIfAvailable();
this.jobParametersConverter = jobParametersConverter.getIfAvailable();
}
@Bean
......
......@@ -57,14 +57,14 @@ class CaffeineCacheConfiguration {
CaffeineCacheConfiguration(CacheProperties cacheProperties,
CacheManagerCustomizers customizers,
ObjectProvider<Caffeine<Object, Object>> caffeineProvider,
ObjectProvider<CaffeineSpec> caffeineSpecProvider,
ObjectProvider<CacheLoader<Object, Object>> cacheLoaderProvider) {
ObjectProvider<Caffeine<Object, Object>> caffeine,
ObjectProvider<CaffeineSpec> caffeineSpec,
ObjectProvider<CacheLoader<Object, Object>> cacheLoader) {
this.cacheProperties = cacheProperties;
this.customizers = customizers;
this.caffeine = caffeineProvider.getIfAvailable();
this.caffeineSpec = caffeineSpecProvider.getIfAvailable();
this.cacheLoader = cacheLoaderProvider.getIfAvailable();
this.caffeine = caffeine.getIfAvailable();
this.caffeineSpec = caffeineSpec.getIfAvailable();
this.cacheLoader = cacheLoader.getIfAvailable();
}
@Bean
......
......@@ -56,11 +56,10 @@ public class InfinispanCacheConfiguration {
public InfinispanCacheConfiguration(CacheProperties cacheProperties,
CacheManagerCustomizers customizers,
ObjectProvider<ConfigurationBuilder> defaultConfigurationBuilderProvider) {
ObjectProvider<ConfigurationBuilder> defaultConfigurationBuilder) {
this.cacheProperties = cacheProperties;
this.customizers = customizers;
this.defaultConfigurationBuilder = defaultConfigurationBuilderProvider
.getIfAvailable();
this.defaultConfigurationBuilder = defaultConfigurationBuilder.getIfAvailable();
}
@Bean
......
......@@ -71,13 +71,12 @@ class JCacheCacheConfiguration {
JCacheCacheConfiguration(CacheProperties cacheProperties,
CacheManagerCustomizers customizers,
ObjectProvider<javax.cache.configuration.Configuration<?, ?>> defaultCacheConfigurationProvider,
ObjectProvider<List<JCacheManagerCustomizer>> cacheManagerCustomizersProvider) {
ObjectProvider<javax.cache.configuration.Configuration<?, ?>> defaultCacheConfiguration,
ObjectProvider<List<JCacheManagerCustomizer>> cacheManagerCustomizers) {
this.cacheProperties = cacheProperties;
this.customizers = customizers;
this.defaultCacheConfiguration = defaultCacheConfigurationProvider
.getIfAvailable();
this.cacheManagerCustomizers = cacheManagerCustomizersProvider.getIfAvailable();
this.defaultCacheConfiguration = defaultCacheConfiguration.getIfAvailable();
this.cacheManagerCustomizers = cacheManagerCustomizers.getIfAvailable();
}
@Bean
......
......@@ -54,10 +54,9 @@ public class CassandraAutoConfiguration {
private final List<ClusterBuilderCustomizer> builderCustomizers;
public CassandraAutoConfiguration(CassandraProperties properties,
ObjectProvider<List<ClusterBuilderCustomizer>> builderCustomizersProvider) {
ObjectProvider<List<ClusterBuilderCustomizer>> builderCustomizers) {
this.properties = properties;
this.builderCustomizers = builderCustomizersProvider
.getIfAvailable();
this.builderCustomizers = builderCustomizers.getIfAvailable();
}
@Bean
......
......@@ -53,10 +53,10 @@ class SpringBootCouchbaseDataConfiguration extends AbstractCouchbaseDataConfigur
SpringBootCouchbaseDataConfiguration(ApplicationContext applicationContext,
CouchbaseDataProperties properties,
ObjectProvider<CouchbaseConfigurer> couchbaseConfigurerProvider) {
ObjectProvider<CouchbaseConfigurer> couchbaseConfigurer) {
this.applicationContext = applicationContext;
this.properties = properties;
this.couchbaseConfigurer = couchbaseConfigurerProvider.getIfAvailable();
this.couchbaseConfigurer = couchbaseConfigurer.getIfAvailable();
}
@Override
......
......@@ -67,11 +67,10 @@ public class Neo4jDataAutoConfiguration {
@Bean
public SessionFactory sessionFactory(org.neo4j.ogm.config.Configuration configuration,
ApplicationContext applicationContext,
ObjectProvider<List<EventListener>> eventListenersProvider) {
ObjectProvider<List<EventListener>> eventListeners) {
SessionFactory sessionFactory = new SessionFactory(configuration,
getPackagesToScan(applicationContext));
List<EventListener> providedEventListeners = eventListenersProvider
.getIfAvailable();
List<EventListener> providedEventListeners = eventListeners.getIfAvailable();
if (providedEventListeners != null) {
for (EventListener eventListener : providedEventListeners) {
sessionFactory.register(eventListener);
......
......@@ -78,11 +78,11 @@ public class RedisAutoConfiguration {
private final RedisClusterConfiguration clusterConfiguration;
public RedisConnectionConfiguration(RedisProperties properties,
ObjectProvider<RedisSentinelConfiguration> sentinelConfigurationProvider,
ObjectProvider<RedisClusterConfiguration> clusterConfigurationProvider) {
ObjectProvider<RedisSentinelConfiguration> sentinelConfiguration,
ObjectProvider<RedisClusterConfiguration> clusterConfiguration) {
this.properties = properties;
this.sentinelConfiguration = sentinelConfigurationProvider.getIfAvailable();
this.clusterConfiguration = clusterConfigurationProvider.getIfAvailable();
this.sentinelConfiguration = sentinelConfiguration.getIfAvailable();
this.clusterConfiguration = clusterConfiguration.getIfAvailable();
}
@Bean
......
......@@ -20,7 +20,8 @@ import io.searchbox.client.config.HttpClientConfig;
/**
* Callback interface that can be implemented by beans wishing to further customize the
* {@link HttpClientConfig} via {@link HttpClientConfig.Builder} retaining its default
* {@link io.searchbox.client.config.HttpClientConfig} via
* {@link io.searchbox.client.config.HttpClientConfig.Builder} retaining its default
* auto-configuration.
*
* @author Stephane Nicoll
......@@ -29,7 +30,7 @@ import io.searchbox.client.config.HttpClientConfig;
public interface HttpClientConfigBuilderCustomizer {
/**
* Customize the {@link HttpClientConfig.Builder}.
* Customize the {@link io.searchbox.client.config.HttpClientConfig.Builder}.
* @param builder the builder to customize
*/
void customize(HttpClientConfig.Builder builder);
......
......@@ -54,12 +54,11 @@ public class JestAutoConfiguration {
private final List<HttpClientConfigBuilderCustomizer> builderCustomizers;
public JestAutoConfiguration(JestProperties properties,
ObjectProvider<Gson> gsonProvider,
ObjectProvider<List<HttpClientConfigBuilderCustomizer>> builderCustomizersProvider) {
public JestAutoConfiguration(JestProperties properties, ObjectProvider<Gson> gson,
ObjectProvider<List<HttpClientConfigBuilderCustomizer>> builderCustomizers) {
this.properties = properties;
this.gsonProvider = gsonProvider;
this.builderCustomizers = builderCustomizersProvider.getIfAvailable();
this.gsonProvider = gson;
this.builderCustomizers = builderCustomizers.getIfAvailable();
}
@Bean(destroyMethod = "shutdownClient")
......
......@@ -93,15 +93,14 @@ public class FlywayAutoConfiguration {
private final FlywayMigrationStrategy migrationStrategy;
public FlywayConfiguration(FlywayProperties properties,
ResourceLoader resourceLoader,
ObjectProvider<DataSource> dataSourceProvider,
@FlywayDataSource ObjectProvider<DataSource> flywayDataSourceProvider,
ObjectProvider<FlywayMigrationStrategy> migrationStrategyProvider) {
ResourceLoader resourceLoader, ObjectProvider<DataSource> dataSource,
@FlywayDataSource ObjectProvider<DataSource> flywayDataSource,
ObjectProvider<FlywayMigrationStrategy> migrationStrategy) {
this.properties = properties;
this.resourceLoader = resourceLoader;
this.dataSource = dataSourceProvider.getIfUnique();
this.flywayDataSource = flywayDataSourceProvider.getIfAvailable();
this.migrationStrategy = migrationStrategyProvider.getIfAvailable();
this.dataSource = dataSource.getIfUnique();
this.flywayDataSource = flywayDataSource.getIfAvailable();
this.migrationStrategy = migrationStrategy.getIfAvailable();
}
@PostConstruct
......@@ -185,7 +184,6 @@ public class FlywayAutoConfiguration {
}
private static class SpringBootFlyway extends Flyway {
private static final String VENDOR_PLACEHOLDER = "{vendor}";
......@@ -194,13 +192,12 @@ public class FlywayAutoConfiguration {
public void setLocations(String... locations) {
if (usesVendorLocation(locations)) {
try {
String url = (String) JdbcUtils.extractDatabaseMetaData(
getDataSource(), "getURL");
String url = (String) JdbcUtils
.extractDatabaseMetaData(getDataSource(), "getURL");
DatabaseDriver vendor = DatabaseDriver.fromJdbcUrl(url);
if (vendor != DatabaseDriver.UNKNOWN) {
for (int i = 0; i < locations.length; i++) {
locations[i] = locations[i].replace(
VENDOR_PLACEHOLDER,
locations[i] = locations[i].replace(VENDOR_PLACEHOLDER,
vendor.getId());
}
}
......@@ -212,7 +209,6 @@ public class FlywayAutoConfiguration {
super.setLocations(locations);
}
private boolean usesVendorLocation(String... locations) {
for (String location : locations) {
if (location.contains(VENDOR_PLACEHOLDER)) {
......
......@@ -77,10 +77,10 @@ public class GroovyTemplateAutoConfiguration {
public GroovyMarkupConfiguration(ApplicationContext applicationContext,
GroovyTemplateProperties properties,
ObjectProvider<MarkupTemplateEngine> templateEngineProvider) {
ObjectProvider<MarkupTemplateEngine> templateEngine) {
this.applicationContext = applicationContext;
this.properties = properties;
this.templateEngine = templateEngineProvider.getIfAvailable();
this.templateEngine = templateEngine.getIfAvailable();
}
@PostConstruct
......
......@@ -100,10 +100,10 @@ public class JerseyAutoConfiguration implements ServletContextAware {
private String path;
public JerseyAutoConfiguration(JerseyProperties jersey, ResourceConfig config,
ObjectProvider<List<ResourceConfigCustomizer>> customizersProvider) {
ObjectProvider<List<ResourceConfigCustomizer>> customizers) {
this.jersey = jersey;
this.config = config;
this.customizers = customizersProvider.getIfAvailable();
this.customizers = customizers.getIfAvailable();
}
@PostConstruct
......
......@@ -56,13 +56,13 @@ class ArtemisEmbeddedServerConfiguration {
private final List<TopicConfiguration> topicsConfiguration;
ArtemisEmbeddedServerConfiguration(ArtemisProperties properties,
ObjectProvider<List<ArtemisConfigurationCustomizer>> configurationCustomizersProvider,
ObjectProvider<List<JMSQueueConfiguration>> queuesConfigurationProvider,
ObjectProvider<List<TopicConfiguration>> topicsConfigurationProvider) {
ObjectProvider<List<ArtemisConfigurationCustomizer>> configurationCustomizers,
ObjectProvider<List<JMSQueueConfiguration>> queuesConfiguration,
ObjectProvider<List<TopicConfiguration>> topicsConfiguration) {
this.properties = properties;
this.configurationCustomizers = configurationCustomizersProvider.getIfAvailable();
this.queuesConfiguration = queuesConfigurationProvider.getIfAvailable();
this.topicsConfiguration = topicsConfigurationProvider.getIfAvailable();
this.configurationCustomizers = configurationCustomizers.getIfAvailable();
this.queuesConfiguration = queuesConfiguration.getIfAvailable();
this.topicsConfiguration = topicsConfiguration.getIfAvailable();
}
@Bean
......
......@@ -83,7 +83,7 @@ public class JooqAutoConfiguration {
private final JooqProperties properties;
private final ConnectionProvider connectionProvider;
private final ConnectionProvider connection;
private final TransactionProvider transactionProvider;
......@@ -99,21 +99,20 @@ public class JooqAutoConfiguration {
public DslContextConfiguration(JooqProperties properties,
ConnectionProvider connectionProvider,
ObjectProvider<TransactionProvider> transactionProviderProvider,
ObjectProvider<RecordMapperProvider> recordMapperProviderProvider,
ObjectProvider<Settings> settingsProvider,
ObjectProvider<RecordListenerProvider[]> recordListenerProvidersProvider,
ObjectProvider<TransactionProvider> transactionProvider,
ObjectProvider<RecordMapperProvider> recordMapperProvider,
ObjectProvider<Settings> settings,
ObjectProvider<RecordListenerProvider[]> recordListenerProviders,
ExecuteListenerProvider[] executeListenerProviders,
ObjectProvider<VisitListenerProvider[]> visitListenerProvidersProvider) {
ObjectProvider<VisitListenerProvider[]> visitListenerProviders) {
this.properties = properties;
this.connectionProvider = connectionProvider;
this.transactionProvider = transactionProviderProvider.getIfAvailable();
this.recordMapperProvider = recordMapperProviderProvider.getIfAvailable();
this.settings = settingsProvider.getIfAvailable();
this.recordListenerProviders = recordListenerProvidersProvider
.getIfAvailable();
this.connection = connectionProvider;
this.transactionProvider = transactionProvider.getIfAvailable();
this.recordMapperProvider = recordMapperProvider.getIfAvailable();
this.settings = settings.getIfAvailable();
this.recordListenerProviders = recordListenerProviders.getIfAvailable();
this.executeListenerProviders = executeListenerProviders;
this.visitListenerProviders = visitListenerProvidersProvider.getIfAvailable();
this.visitListenerProviders = visitListenerProviders.getIfAvailable();
}
@Bean
......@@ -128,7 +127,7 @@ public class JooqAutoConfiguration {
if (this.properties.getSqlDialect() != null) {
configuration.set(this.properties.getSqlDialect());
}
configuration.set(this.connectionProvider);
configuration.set(this.connection);
if (this.transactionProvider != null) {
configuration.set(this.transactionProvider);
}
......
......@@ -77,11 +77,11 @@ public class LiquibaseAutoConfiguration {
public LiquibaseConfiguration(LiquibaseProperties properties,
ResourceLoader resourceLoader, DataSource dataSource,
@LiquibaseDataSource ObjectProvider<DataSource> liquibaseDataSourceProvider) {
@LiquibaseDataSource ObjectProvider<DataSource> liquibaseDataSource) {
this.properties = properties;
this.resourceLoader = resourceLoader;
this.dataSource = dataSource;
this.liquibaseDataSource = liquibaseDataSourceProvider.getIfAvailable();
this.liquibaseDataSource = liquibaseDataSource.getIfAvailable();
}
@PostConstruct
......
......@@ -59,9 +59,9 @@ public class MailSenderAutoConfiguration {
private final Session session;
public MailSenderAutoConfiguration(MailProperties properties,
ObjectProvider<Session> sessionProvider) {
ObjectProvider<Session> session) {
this.properties = properties;
this.session = sessionProvider.getIfAvailable();
this.session = session.getIfAvailable();
}
@Bean
......
......@@ -54,9 +54,9 @@ public class MongoAutoConfiguration {
private MongoClient mongo;
public MongoAutoConfiguration(MongoProperties properties,
ObjectProvider<MongoClientOptions> optionsProvider, Environment environment) {
ObjectProvider<MongoClientOptions> options, Environment environment) {
this.properties = properties;
this.options = optionsProvider.getIfAvailable();
this.options = options.getIfAvailable();
this.environment = environment;
}
......
......@@ -88,8 +88,8 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration {
public HibernateJpaAutoConfiguration(DataSource dataSource,
JpaProperties jpaProperties,
ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider) {
super(dataSource, jpaProperties, jtaTransactionManagerProvider);
ObjectProvider<JtaTransactionManager> jtaTransactionManager) {
super(dataSource, jpaProperties, jtaTransactionManager);
}
@Override
......
......@@ -74,10 +74,10 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware {
private ConfigurableListableBeanFactory beanFactory;
protected JpaBaseConfiguration(DataSource dataSource, JpaProperties properties,
ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider) {
ObjectProvider<JtaTransactionManager> jtaTransactionManager) {
this.dataSource = dataSource;
this.properties = properties;
this.jtaTransactionManager = jtaTransactionManagerProvider.getIfAvailable();
this.jtaTransactionManager = jtaTransactionManager.getIfAvailable();
}
@Bean
......@@ -103,10 +103,10 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware {
@ConditionalOnMissingBean
public EntityManagerFactoryBuilder entityManagerFactoryBuilder(
JpaVendorAdapter jpaVendorAdapter,
ObjectProvider<PersistenceUnitManager> persistenceUnitManagerProvider) {
ObjectProvider<PersistenceUnitManager> persistenceUnitManager) {
EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilder(
jpaVendorAdapter, this.properties.getProperties(),
persistenceUnitManagerProvider.getIfAvailable());
persistenceUnitManager.getIfAvailable());
builder.setCallback(getVendorCallback());
return builder;
}
......
......@@ -78,11 +78,11 @@ public class OAuth2AuthorizationServerConfiguration
public OAuth2AuthorizationServerConfiguration(BaseClientDetails details,
AuthenticationManager authenticationManager,
ObjectProvider<TokenStore> tokenStoreProvider,
ObjectProvider<TokenStore> tokenStore,
AuthorizationServerProperties properties) {
this.details = details;
this.authenticationManager = authenticationManager;
this.tokenStore = tokenStoreProvider.getIfAvailable();
this.tokenStore = tokenStore.getIfAvailable();
this.properties = properties;
}
......
......@@ -85,11 +85,10 @@ public class ResourceServerTokenServicesConfiguration {
@Bean
@ConditionalOnMissingBean
public UserInfoRestTemplateFactory userInfoRestTemplateFactory(
ObjectProvider<List<UserInfoRestTemplateCustomizer>> customizersProvider,
ObjectProvider<OAuth2ProtectedResourceDetails> detailsProvider,
ObjectProvider<OAuth2ClientContext> oauth2ClientContextProvider) {
return new UserInfoRestTemplateFactory(customizersProvider, detailsProvider,
oauth2ClientContextProvider);
ObjectProvider<List<UserInfoRestTemplateCustomizer>> customizers,
ObjectProvider<OAuth2ProtectedResourceDetails> details,
ObjectProvider<OAuth2ClientContext> oauth2ClientContext) {
return new UserInfoRestTemplateFactory(customizers, details, oauth2ClientContext);
}
@Configuration
......@@ -133,12 +132,12 @@ public class ResourceServerTokenServicesConfiguration {
private final PrincipalExtractor principalExtractor;
public SocialTokenServicesConfiguration(ResourceServerProperties sso,
ObjectProvider<OAuth2ConnectionFactory<?>> connectionFactoryProvider,
ObjectProvider<OAuth2ConnectionFactory<?>> connectionFactory,
UserInfoRestTemplateFactory restTemplateFactory,
ObjectProvider<AuthoritiesExtractor> authoritiesExtractor,
ObjectProvider<PrincipalExtractor> principalExtractor) {
this.sso = sso;
this.connectionFactory = connectionFactoryProvider.getIfAvailable();
this.connectionFactory = connectionFactory.getIfAvailable();
this.restTemplate = restTemplateFactory.getUserInfoRestTemplate();
this.authoritiesExtractor = authoritiesExtractor.getIfAvailable();
this.principalExtractor = principalExtractor.getIfAvailable();
......@@ -225,9 +224,9 @@ public class ResourceServerTokenServicesConfiguration {
private final List<JwtAccessTokenConverterConfigurer> configurers;
public JwtTokenServicesConfiguration(ResourceServerProperties resource,
ObjectProvider<List<JwtAccessTokenConverterConfigurer>> configurersProvider) {
ObjectProvider<List<JwtAccessTokenConverterConfigurer>> configurers) {
this.resource = resource;
this.configurers = configurersProvider.getIfAvailable();
this.configurers = configurers.getIfAvailable();
}
@Bean
......
......@@ -59,12 +59,12 @@ public class UserInfoRestTemplateFactory {
private OAuth2RestTemplate template;
public UserInfoRestTemplateFactory(
ObjectProvider<List<UserInfoRestTemplateCustomizer>> customizersProvider,
ObjectProvider<OAuth2ProtectedResourceDetails> detailsProvider,
ObjectProvider<OAuth2ClientContext> oauth2ClientContextProvider) {
this.customizers = customizersProvider.getIfAvailable();
this.details = detailsProvider.getIfAvailable();
this.oauth2ClientContext = oauth2ClientContextProvider.getIfAvailable();
ObjectProvider<List<UserInfoRestTemplateCustomizer>> customizers,
ObjectProvider<OAuth2ProtectedResourceDetails> details,
ObjectProvider<OAuth2ClientContext> oauth2ClientContext) {
this.customizers = customizers.getIfAvailable();
this.details = details.getIfAvailable();
this.oauth2ClientContext = oauth2ClientContext.getIfAvailable();
}
public OAuth2RestTemplate getUserInfoRestTemplate() {
......
......@@ -88,10 +88,11 @@ public class JestAutoConfigurationTests {
@Test
public void customizerOverridesAutoConfig() {
load(BuilderCustomizer.class, "spring.elasticsearch.jest.uris=http://localhost:9200");
load(BuilderCustomizer.class,
"spring.elasticsearch.jest.uris=http://localhost:9200");
JestHttpClient client = (JestHttpClient) this.context.getBean(JestClient.class);
assertThat(client.getGson()).isSameAs(
this.context.getBean(BuilderCustomizer.class).getGson());
assertThat(client.getGson())
.isSameAs(this.context.getBean(BuilderCustomizer.class).getGson());
}
@Test
......@@ -166,10 +167,12 @@ public class JestAutoConfigurationTests {
@Bean
public HttpClientConfigBuilderCustomizer customizer() {
return new HttpClientConfigBuilderCustomizer() {
@Override
public void customize(HttpClientConfig.Builder builder) {
builder.gson(BuilderCustomizer.this.gson);
}
};
}
......
......@@ -57,11 +57,11 @@ public class CustomRestTemplateBasicOAuth2SsoConfigurationTests {
private ApplicationContext applicationContext;
@Autowired
private ObjectProvider<RestTemplate> restTemplateProvider;
private ObjectProvider<RestTemplate> restTemplate;
@Test
public void customRestTemplateCanBePrimary() {
RestTemplate restTemplate = this.restTemplateProvider.getIfAvailable();
RestTemplate restTemplate = this.restTemplate.getIfAvailable();
verifyZeroInteractions(restTemplate);
assertThat(this.applicationContext.getBeansOfType(RestTemplate.class)).hasSize(1);
}
......
......@@ -1043,7 +1043,7 @@ is set. The client component must be launched manually.
==== Running the remote client application
The remote client application is designed to be run from within you IDE. You need to run
The remote client application is designed to be run from within your IDE. You need to run
`org.springframework.boot.devtools.RemoteSpringApplication` using the same classpath as
the remote project that you're connecting to. The _non-option_ argument passed to the
application should be the remote URL that you are connecting to.
......
......@@ -37,9 +37,9 @@ public class JestClientCustomizationExample {
@Override
public void customize(HttpClientConfig.Builder builder) {
builder.maxTotalConnection(100)
.defaultMaxTotalConnectionPerRoute(5);
builder.maxTotalConnection(100).defaultMaxTotalConnectionPerRoute(5);
}
}
// end::customizer[]
}
......@@ -232,6 +232,11 @@
<artifactId>kotlin-runtime</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-build-api</artifactId>
<version>0.0.7</version>
</dependency>
<dependency>
<groupId>org.zeroturnaround</groupId>
<artifactId>zt-zip</artifactId>
......
= Spring Boot Sample Data Cassandra
To run the project, need to run below `cql` commands on Cassandra.
CREATE KEYSPACE mykeyspace WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
== Keyspace Creation in Cassandra
[source,indent=0]
----
CREATE KEYSPACE mykeyspace WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
----
== Table Creation in Cassandra
Run `cql` using the link:src/test/resources/setup.cql[setup script] located in resources folder.
......@@ -16,11 +16,48 @@
package sample.devtools;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for {@link SampleDevToolsApplication}.
*
* @author Andy Wilkinson
* @author Phillip Webb
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@DirtiesContext
public class SampleDevToolsApplicationIntegrationTests {
@Autowired
private TestRestTemplate restTemplate;
@Test
public void testStaticResource() throws Exception {
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/css/application.css", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("color: green;");
}
@Test
public void testPublicResource() throws Exception {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/public.txt",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("public file");
}
}
/*
* Copyright 2012-2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.test.context;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.PortTest.RandomPortInitailizer;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.support.TestPropertySourceUtils;
import org.springframework.util.SocketUtils;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest
@ContextConfiguration(initializers = RandomPortInitailizer.class)
public class PortTest {
@Autowired
private SomeService service;
@Test
public void testName() throws Exception {
System.out.println(this.service);
assertThat(this.service.toString()).containsOnlyDigits();
}
@Configuration
static class MyConfig {
@Bean
public SomeService someService(@Value("${my.random.port}") int port) {
return new SomeService(port);
}
}
static class SomeService {
private final int port;
public SomeService(int port) {
this.port = port;
}
@Override
public String toString() {
return String.valueOf(this.port);
}
}
public static class RandomPortInitailizer
implements ApplicationContextInitializer<ConfigurableApplicationContext> {
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
int randomPort = SocketUtils.findAvailableTcpPort();
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(applicationContext,
"my.random.port=" + randomPort);
}
}
}
......@@ -170,6 +170,10 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-build-api</artifactId>
</dependency>
<!-- Optional -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
......
......@@ -22,10 +22,12 @@ import java.util.Map;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.sonatype.plexus.build.incremental.BuildContext;
import org.springframework.boot.loader.tools.BuildPropertiesWriter;
import org.springframework.boot.loader.tools.BuildPropertiesWriter.NullAdditionalPropertyValueException;
......@@ -41,6 +43,9 @@ import org.springframework.boot.loader.tools.BuildPropertiesWriter.ProjectDetail
@Mojo(name = "build-info", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true)
public class BuildInfoMojo extends AbstractMojo {
@Component
private BuildContext buildContext;
/**
* The Maven project.
*/
......@@ -67,6 +72,7 @@ public class BuildInfoMojo extends AbstractMojo {
.writeBuildProperties(new ProjectDetails(this.project.getGroupId(),
this.project.getArtifactId(), this.project.getVersion(),
this.project.getName(), this.additionalProperties));
this.buildContext.refresh(this.outputFile);
}
catch (NullAdditionalPropertyValueException ex) {
throw new MojoFailureException(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment