Isolate Boot-specific Processors

Previously, the Boot-specific processors were in the same package as the core
types.  This minimzed the visibility of some constructors used for testing,
but as the list of processors has grown (and will continue to grow), the core
types were being overwhelmed.

This change moves the Boot-specific processors out to an additional package
where they can be easily identified.

Signed-off-by: Ben Hale <bhale@vmware.com>
This commit is contained in:
Ben Hale
2020-05-11 07:35:45 -07:00
parent 7491ff56e1
commit 30b1a88644
22 changed files with 90 additions and 41 deletions

View File

@@ -84,7 +84,12 @@ public final class Bindings {
}
}
Bindings(@NotNull Binding... bindings) {
/**
* Creates a new {@code Bindings} instance using the specified content.
*
* @param bindings the {@code Binding}s.
*/
public Bindings(@NotNull Binding... bindings) {
this.bindings = Arrays.asList(bindings);
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -22,6 +22,7 @@ import org.jetbrains.annotations.NotNull;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.config.ConfigFileApplicationListener;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.core.env.ConfigurableEnvironment;

View File

@@ -14,8 +14,9 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.lang.NonNull;
import java.util.Map;

View File

@@ -14,9 +14,11 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.jetbrains.annotations.NotNull;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.lang.NonNull;
import java.util.Map;

View File

@@ -14,9 +14,11 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.jetbrains.annotations.NotNull;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.lang.NonNull;
import java.util.Map;

View File

@@ -14,8 +14,10 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.lang.NonNull;
import java.util.Map;

View File

@@ -14,9 +14,11 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.jetbrains.annotations.NotNull;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.lang.NonNull;
import java.util.Map;

View File

@@ -14,9 +14,11 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.jetbrains.annotations.NotNull;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.lang.NonNull;
import java.util.Map;

View File

@@ -14,9 +14,11 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.jetbrains.annotations.NotNull;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.lang.NonNull;
import java.util.Map;

View File

@@ -14,9 +14,11 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.jetbrains.annotations.NotNull;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.lang.NonNull;
import java.util.Map;

View File

@@ -14,9 +14,11 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.jetbrains.annotations.NotNull;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.lang.NonNull;
import java.util.Map;

View File

@@ -1,12 +1,12 @@
org.springframework.boot.env.EnvironmentPostProcessor=\
org.springframework.cloud.bindings.BindingsEnvironmentPostProcessor
org.springframework.cloud.bindings.boot.BindingsEnvironmentPostProcessor
# Included implementations
org.springframework.cloud.bindings.BindingsPropertiesProcessor=\
org.springframework.cloud.bindings.CassandraBindingsPropertiesProcessor, \
org.springframework.cloud.bindings.Db2BindingsPropertiesProcessor, \
org.springframework.cloud.bindings.MongoDbBindingsPropertiesProcessor, \
org.springframework.cloud.bindings.MySqlBindingsPropertiesProcessor, \
org.springframework.cloud.bindings.OracleBindingsPropertiesProcessor, \
org.springframework.cloud.bindings.PostgreSqlBindingsPropertiesProcessor, \
org.springframework.cloud.bindings.RedisBindingsPropertiesProcessor, \
org.springframework.cloud.bindings.SqlServerBindingsPropertiesProcessor
org.springframework.cloud.bindings.boot.BindingsPropertiesProcessor=\
org.springframework.cloud.bindings.boot.CassandraBindingsPropertiesProcessor, \
org.springframework.cloud.bindings.boot.Db2BindingsPropertiesProcessor, \
org.springframework.cloud.bindings.boot.MongoDbBindingsPropertiesProcessor, \
org.springframework.cloud.bindings.boot.MySqlBindingsPropertiesProcessor, \
org.springframework.cloud.bindings.boot.OracleBindingsPropertiesProcessor, \
org.springframework.cloud.bindings.boot.PostgreSqlBindingsPropertiesProcessor, \
org.springframework.cloud.bindings.boot.RedisBindingsPropertiesProcessor, \
org.springframework.cloud.bindings.boot.SqlServerBindingsPropertiesProcessor

View File

@@ -18,9 +18,9 @@ package org.springframework.cloud.bindings;
import java.util.HashMap;
final class FluentMap extends HashMap<String, String> {
public final class FluentMap extends HashMap<String, String> {
FluentMap withEntry(String key, String value) {
public FluentMap withEntry(String key, String value) {
put(key, value);
return this;
}

View File

@@ -14,12 +14,14 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.config.ConfigFileApplicationListener;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.core.env.PropertySource;
import org.springframework.core.env.SimpleCommandLinePropertySource;
import org.springframework.mock.env.MockEnvironment;
@@ -28,7 +30,7 @@ import java.nio.file.Paths;
import java.util.Collections;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cloud.bindings.BindingsEnvironmentPostProcessor.BINDINGS_PROPERTY_SOURCE_NAME;
import static org.springframework.cloud.bindings.boot.BindingsEnvironmentPostProcessor.BINDINGS_PROPERTY_SOURCE_NAME;
@DisplayName("Bindings EnvironmentPostProcessor")
final class BindingsEnvironmentPostProcessorTest {

View File

@@ -14,17 +14,20 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.cloud.bindings.FluentMap;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cloud.bindings.CassandraBindingsPropertiesProcessor.KIND;
import static org.springframework.cloud.bindings.boot.CassandraBindingsPropertiesProcessor.KIND;
@DisplayName("Cassandra BindingsPropertiesProcessor")
final class CassandraBindingsPropertiesProcessorTest {

View File

@@ -14,17 +14,20 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.cloud.bindings.FluentMap;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cloud.bindings.Db2BindingsPropertiesProcessor.KIND;
import static org.springframework.cloud.bindings.boot.Db2BindingsPropertiesProcessor.KIND;
@DisplayName("DB2 BindingsPropertiesProcessor")
final class Db2BindingsPropertiesProcessorTest {

View File

@@ -14,17 +14,20 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.cloud.bindings.FluentMap;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cloud.bindings.MongoDbBindingsPropertiesProcessor.KIND;
import static org.springframework.cloud.bindings.boot.MongoDbBindingsPropertiesProcessor.KIND;
@DisplayName("MongoDB BindingsPropertiesProcessor")
final class MongoDbBindingsPropertiesProcessorTest {

View File

@@ -14,17 +14,20 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.cloud.bindings.FluentMap;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cloud.bindings.MySqlBindingsPropertiesProcessor.KIND;
import static org.springframework.cloud.bindings.boot.MySqlBindingsPropertiesProcessor.KIND;
@DisplayName("MySQL BindingsPropertiesProcessor")
final class MySqlBindingsPropertiesProcessorTest {

View File

@@ -14,17 +14,20 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.cloud.bindings.FluentMap;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cloud.bindings.OracleBindingsPropertiesProcessor.KIND;
import static org.springframework.cloud.bindings.boot.OracleBindingsPropertiesProcessor.KIND;
@DisplayName("Oracle BindingsPropertiesProcessor")
final class OracleBindingsPropertiesProcessorTest {

View File

@@ -14,17 +14,20 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.cloud.bindings.FluentMap;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cloud.bindings.PostgreSqlBindingsPropertiesProcessor.KIND;
import static org.springframework.cloud.bindings.boot.PostgreSqlBindingsPropertiesProcessor.KIND;
@DisplayName("PostgreSQL BindingsPropertiesProcessor")
final class PostgreSqlBindingsPropertiesProcessorTest {

View File

@@ -14,17 +14,20 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.cloud.bindings.FluentMap;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cloud.bindings.RedisBindingsPropertiesProcessor.KIND;
import static org.springframework.cloud.bindings.boot.RedisBindingsPropertiesProcessor.KIND;
@DisplayName("Redis BindingsPropertiesProcessor")
final class RedisBindingsPropertiesProcessorTest {

View File

@@ -14,17 +14,20 @@
* limitations under the License.
*/
package org.springframework.cloud.bindings;
package org.springframework.cloud.bindings.boot;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.cloud.bindings.Binding;
import org.springframework.cloud.bindings.Bindings;
import org.springframework.cloud.bindings.FluentMap;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cloud.bindings.SqlServerBindingsPropertiesProcessor.KIND;
import static org.springframework.cloud.bindings.boot.SqlServerBindingsPropertiesProcessor.KIND;
@DisplayName("SQLServer BindingsPropertiesProcessor")
final class SqlServerBindingsPropertiesProcessorTest {