parent
ba18fb529f
commit
42bf594d96
|
@ -34,7 +34,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.5
|
* @since 2.0.5
|
||||||
*/
|
*/
|
||||||
public class OnListCondition extends SpringBootCondition {
|
public class OnPropertyListCondition extends SpringBootCondition {
|
||||||
|
|
||||||
private static final Bindable<List<String>> SIMPLE_LIST = Bindable
|
private static final Bindable<List<String>> SIMPLE_LIST = Bindable
|
||||||
.listOf(String.class);
|
.listOf(String.class);
|
||||||
|
@ -49,7 +49,7 @@ public class OnListCondition extends SpringBootCondition {
|
||||||
* @param messageBuilder a message builder supplier that should provide a fresh
|
* @param messageBuilder a message builder supplier that should provide a fresh
|
||||||
* instance on each call
|
* instance on each call
|
||||||
*/
|
*/
|
||||||
protected OnListCondition(String propertyName,
|
protected OnPropertyListCondition(String propertyName,
|
||||||
Supplier<ConditionMessage.Builder> messageBuilder) {
|
Supplier<ConditionMessage.Builder> messageBuilder) {
|
||||||
this.propertyName = propertyName;
|
this.propertyName = propertyName;
|
||||||
this.messageBuilder = messageBuilder;
|
this.messageBuilder = messageBuilder;
|
|
@ -17,7 +17,7 @@
|
||||||
package org.springframework.boot.autoconfigure.couchbase;
|
package org.springframework.boot.autoconfigure.couchbase;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
|
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
|
||||||
import org.springframework.boot.autoconfigure.condition.OnListCondition;
|
import org.springframework.boot.autoconfigure.condition.OnPropertyListCondition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Condition to determine if {@code spring.couchbase.bootstrap-hosts} is specified.
|
* Condition to determine if {@code spring.couchbase.bootstrap-hosts} is specified.
|
||||||
|
@ -26,7 +26,7 @@ import org.springframework.boot.autoconfigure.condition.OnListCondition;
|
||||||
* @author Madhura Bhave
|
* @author Madhura Bhave
|
||||||
* @author Eneias Silva
|
* @author Eneias Silva
|
||||||
*/
|
*/
|
||||||
class OnBootstrapHostsCondition extends OnListCondition {
|
class OnBootstrapHostsCondition extends OnPropertyListCondition {
|
||||||
|
|
||||||
OnBootstrapHostsCondition() {
|
OnBootstrapHostsCondition() {
|
||||||
super("spring.couchbase.bootstrap-hosts",
|
super("spring.couchbase.bootstrap-hosts",
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.springframework.boot.autoconfigure.webservices;
|
package org.springframework.boot.autoconfigure.webservices;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
|
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
|
||||||
import org.springframework.boot.autoconfigure.condition.OnListCondition;
|
import org.springframework.boot.autoconfigure.condition.OnPropertyListCondition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Condition to determine if {@code spring.webservices.wsdl-locations} is specified.
|
* Condition to determine if {@code spring.webservices.wsdl-locations} is specified.
|
||||||
|
@ -25,7 +25,7 @@ import org.springframework.boot.autoconfigure.condition.OnListCondition;
|
||||||
* @author Eneias Silva
|
* @author Eneias Silva
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
*/
|
*/
|
||||||
class OnWsdlLocationsCondition extends OnListCondition {
|
class OnWsdlLocationsCondition extends OnPropertyListCondition {
|
||||||
|
|
||||||
OnWsdlLocationsCondition() {
|
OnWsdlLocationsCondition() {
|
||||||
super("spring.webservices.wsdl-locations",
|
super("spring.webservices.wsdl-locations",
|
||||||
|
|
|
@ -26,11 +26,11 @@ import org.springframework.context.annotation.Configuration;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link OnListCondition}.
|
* Tests for {@link OnPropertyListCondition}.
|
||||||
*
|
*
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
*/
|
*/
|
||||||
public class OnListConditionTests {
|
public class OnPropertyListConditionTests {
|
||||||
|
|
||||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||||
.withUserConfiguration(TestConfig.class);
|
.withUserConfiguration(TestConfig.class);
|
||||||
|
@ -65,7 +65,7 @@ public class OnListConditionTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Conditional(TestListCondition.class)
|
@Conditional(TestPropertyListCondition.class)
|
||||||
protected static class TestConfig {
|
protected static class TestConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ -75,9 +75,9 @@ public class OnListConditionTests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class TestListCondition extends OnListCondition {
|
static class TestPropertyListCondition extends OnPropertyListCondition {
|
||||||
|
|
||||||
TestListCondition() {
|
TestPropertyListCondition() {
|
||||||
super("spring.test.my-list", () -> ConditionMessage.forCondition("test"));
|
super("spring.test.my-list", () -> ConditionMessage.forCondition("test"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue