Commit cfd0ab76 authored by Stephane Nicoll's avatar Stephane Nicoll

Remove `spring.cloud.enabled` property

This commit removes an undocumented property and rename the Spring
Cloud Service Connectors auto-configuration.

Closes gh-14219
parent ae413c71
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -20,7 +20,6 @@ import org.springframework.boot.autoconfigure.AutoConfigureOrder; ...@@ -20,7 +20,6 @@ import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.Cloud; import org.springframework.cloud.Cloud;
import org.springframework.cloud.app.ApplicationInstanceInfo; import org.springframework.cloud.app.ApplicationInstanceInfo;
import org.springframework.cloud.config.java.CloudScan; import org.springframework.cloud.config.java.CloudScan;
...@@ -31,28 +30,26 @@ import org.springframework.context.annotation.Profile; ...@@ -31,28 +30,26 @@ import org.springframework.context.annotation.Profile;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
/** /**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Cloud. * {@link EnableAutoConfiguration Auto-configuration} for Spring Cloud Service Connectors.
* <p> * <p>
* Activates when there is no bean of type {@link Cloud} is configured in the context, the * Activates when there is no bean of type {@link Cloud} and the "cloud" profile is
* {@link Cloud} type (this spring-cloud) is on the classpath, and the "cloud" profile is
* active. * active.
* <p> * <p>
* Once in effect, the auto-configuration is the equivalent of adding the * Once in effect, the auto-configuration is the equivalent of adding the
* {@link CloudScan} annotation in one of the configuration file. Specifically, it adds a * {@link CloudScan} annotation in one of the configuration file. Specifically, it adds a
* bean for each service bound to the application and one for * bean for each service bound to the application and one for
* {@link ApplicationInstanceInfo} * {@link ApplicationInstanceInfo}.
* *
* @author Ramnivas Laddad * @author Ramnivas Laddad
* @since 1.2.0 * @since 1.2.0
*/ */
@Configuration @Configuration
@Profile("cloud") @Profile("cloud")
@AutoConfigureOrder(CloudAutoConfiguration.ORDER) @AutoConfigureOrder(CloudServiceConnectorsAutoConfiguration.ORDER)
@ConditionalOnClass(CloudScanConfiguration.class) @ConditionalOnClass(CloudScanConfiguration.class)
@ConditionalOnMissingBean(Cloud.class) @ConditionalOnMissingBean(Cloud.class)
@ConditionalOnProperty(prefix = "spring.cloud", name = "enabled", havingValue = "true", matchIfMissing = true)
@Import(CloudScanConfiguration.class) @Import(CloudScanConfiguration.class)
public class CloudAutoConfiguration { public class CloudServiceConnectorsAutoConfiguration {
// Cloud configuration needs to happen early (before data, mongo etc.) // Cloud configuration needs to happen early (before data, mongo etc.)
public static final int ORDER = Ordered.HIGHEST_PRECEDENCE + 20; public static final int ORDER = Ordered.HIGHEST_PRECEDENCE + 20;
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -15,6 +15,6 @@ ...@@ -15,6 +15,6 @@
*/ */
/** /**
* Auto-configuration for Spring Cloud Connectors. * Auto-configuration for Spring Cloud Service Connectors.
*/ */
package org.springframework.boot.autoconfigure.cloud; package org.springframework.boot.autoconfigure.cloud;
...@@ -27,7 +27,7 @@ org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration,\ ...@@ -27,7 +27,7 @@ org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration,\
org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration,\ org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration,\
org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration,\ org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration,\
org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration,\ org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration,\
org.springframework.boot.autoconfigure.cloud.CloudAutoConfiguration,\ org.springframework.boot.autoconfigure.cloud.CloudServiceConnectorsAutoConfiguration,\
org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration,\ org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration,\
org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration,\ org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration,\
org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration,\ org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration,\
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -32,11 +32,11 @@ import org.springframework.core.type.classreading.CachingMetadataReaderFactory; ...@@ -32,11 +32,11 @@ import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Tests for {@link CloudAutoConfiguration}. * Tests for {@link CloudServiceConnectorsAutoConfiguration}.
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
public class CloudAutoConfigurationTests { public class CloudServiceConnectorsAutoConfigurationTests {
@Test @Test
public void testOrder() { public void testOrder() {
...@@ -47,9 +47,10 @@ public class CloudAutoConfigurationTests { ...@@ -47,9 +47,10 @@ public class CloudAutoConfigurationTests {
classNames.add(DataSourceAutoConfiguration.class.getName()); classNames.add(DataSourceAutoConfiguration.class.getName());
classNames.add(MongoRepositoriesAutoConfiguration.class.getName()); classNames.add(MongoRepositoriesAutoConfiguration.class.getName());
classNames.add(JpaRepositoriesAutoConfiguration.class.getName()); classNames.add(JpaRepositoriesAutoConfiguration.class.getName());
classNames.add(CloudAutoConfiguration.class.getName()); classNames.add(CloudServiceConnectorsAutoConfiguration.class.getName());
List<String> ordered = sorter.getInPriorityOrder(classNames); List<String> ordered = sorter.getInPriorityOrder(classNames);
assertThat(ordered.get(0)).isEqualTo(CloudAutoConfiguration.class.getName()); assertThat(ordered.get(0))
.isEqualTo(CloudServiceConnectorsAutoConfiguration.class.getName());
} }
} }
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