Merge branch '1.5.x'
This commit is contained in:
@@ -18,11 +18,11 @@
|
||||
<main.basedir>${basedir}/..</main.basedir>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- Compile -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Provided -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -627,7 +627,6 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka-test</artifactId>
|
||||
<version>${spring-kafka.version}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
||||
@@ -49,8 +49,7 @@ import org.springframework.context.annotation.Primary;
|
||||
public class CouchbaseAutoConfiguration {
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnMissingBean(value = CouchbaseConfiguration.class,
|
||||
type = "org.springframework.data.couchbase.config.CouchbaseConfigurer")
|
||||
@ConditionalOnMissingBean(value = CouchbaseConfiguration.class, type = "org.springframework.data.couchbase.config.CouchbaseConfigurer")
|
||||
public static class CouchbaseConfiguration {
|
||||
|
||||
private final CouchbaseProperties properties;
|
||||
@@ -124,8 +123,9 @@ public class CouchbaseAutoConfiguration {
|
||||
* Determine if Couchbase should be configured. This happens if either the
|
||||
* user-configuration defines a {@code CouchbaseConfigurer} or if at least the
|
||||
* "bootstrapHosts" property is specified.
|
||||
* <p>The reason why we check for the presence of {@code CouchbaseConfigurer} is
|
||||
* that it might use {@link CouchbaseProperties} for its internal customization.
|
||||
* <p>
|
||||
* The reason why we check for the presence of {@code CouchbaseConfigurer} is that it
|
||||
* might use {@link CouchbaseProperties} for its internal customization.
|
||||
*/
|
||||
static class CouchbaseCondition extends AnyNestedCondition {
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ abstract class DataSourceConfiguration {
|
||||
return (T) properties.initializeDataSourceBuilder().type(type).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tomcat Pool DataSource configuration.
|
||||
*/
|
||||
@ConditionalOnClass(org.apache.tomcat.jdbc.pool.DataSource.class)
|
||||
@ConditionalOnProperty(name = "spring.datasource.type", havingValue = "org.apache.tomcat.jdbc.pool.DataSource", matchIfMissing = true)
|
||||
static class Tomcat extends DataSourceConfiguration {
|
||||
@@ -64,6 +67,9 @@ abstract class DataSourceConfiguration {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Hikari DataSource configuration.
|
||||
*/
|
||||
@ConditionalOnClass(HikariDataSource.class)
|
||||
@ConditionalOnProperty(name = "spring.datasource.type", havingValue = "com.zaxxer.hikari.HikariDataSource", matchIfMissing = true)
|
||||
static class Hikari extends DataSourceConfiguration {
|
||||
@@ -75,6 +81,9 @@ abstract class DataSourceConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DBCP DataSource configuration.
|
||||
*/
|
||||
@ConditionalOnClass(org.apache.commons.dbcp2.BasicDataSource.class)
|
||||
@ConditionalOnProperty(name = "spring.datasource.type", havingValue = "org.apache.commons.dbcp2.BasicDataSource", matchIfMissing = true)
|
||||
static class Dbcp2 extends DataSourceConfiguration {
|
||||
@@ -88,6 +97,9 @@ abstract class DataSourceConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic DataSource configuration.
|
||||
*/
|
||||
@ConditionalOnMissingBean(DataSource.class)
|
||||
@ConditionalOnProperty(name = "spring.datasource.type")
|
||||
static class Generic {
|
||||
|
||||
@@ -58,8 +58,8 @@ public class ValidationAutoConfiguration {
|
||||
@Override
|
||||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||
AnnotatedTypeMetadata metadata) {
|
||||
ConditionMessage.Builder message = ConditionMessage.forCondition(
|
||||
getClass().getName());
|
||||
ConditionMessage.Builder message = ConditionMessage
|
||||
.forCondition(getClass().getName());
|
||||
try {
|
||||
Validation.buildDefaultValidatorFactory().getValidator();
|
||||
return ConditionOutcome.match(message.available("JSR-303 provider"));
|
||||
|
||||
@@ -66,7 +66,8 @@ public class CassandraAutoConfigurationTests {
|
||||
public void createCustomizeCluster() {
|
||||
load(ClusterConfig.class);
|
||||
assertThat(this.context.getBeanNamesForType(Cluster.class).length).isEqualTo(1);
|
||||
assertThat(this.context.getBeanNamesForType(ClusterCustomizer.class).length).isEqualTo(1);
|
||||
assertThat(this.context.getBeanNamesForType(ClusterCustomizer.class).length)
|
||||
.isEqualTo(1);
|
||||
}
|
||||
|
||||
private void load(String... environment) {
|
||||
@@ -85,7 +86,6 @@ public class CassandraAutoConfigurationTests {
|
||||
this.context = ctx;
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
static class ClusterConfig {
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ public class ConditionalOnMissingBeanWithFilteredClasspathTests {
|
||||
assertThat(this.context.containsBean("foo")).isTrue();
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
static class OnBeanTypeConfiguration {
|
||||
|
||||
@@ -66,6 +65,7 @@ public class ConditionalOnMissingBeanWithFilteredClasspathTests {
|
||||
}
|
||||
|
||||
static class TestCacheManager extends CaffeineCacheManager {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -70,8 +70,9 @@ public class SessionAutoConfigurationHazelcastTests
|
||||
"spring.session.hazelcast.flush-mode=immediate");
|
||||
HazelcastSessionRepository repository = validateSessionRepository(
|
||||
HazelcastSessionRepository.class);
|
||||
assertThat(new DirectFieldAccessor(repository).getPropertyValue(
|
||||
"hazelcastFlushMode")).isEqualTo(HazelcastFlushMode.IMMEDIATE);
|
||||
assertThat(new DirectFieldAccessor(repository)
|
||||
.getPropertyValue("hazelcastFlushMode"))
|
||||
.isEqualTo(HazelcastFlushMode.IMMEDIATE);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -97,7 +97,6 @@ public class SessionAutoConfigurationTests extends AbstractSessionAutoConfigurat
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void mongoSessionStore() {
|
||||
load(Arrays.asList(EmbeddedMongoAutoConfiguration.class,
|
||||
MongoAutoConfiguration.class, MongoDataAutoConfiguration.class),
|
||||
@@ -106,7 +105,6 @@ public class SessionAutoConfigurationTests extends AbstractSessionAutoConfigurat
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void mongoSessionStoreWithCustomizations() {
|
||||
load(Arrays.asList(EmbeddedMongoAutoConfiguration.class,
|
||||
MongoAutoConfiguration.class, MongoDataAutoConfiguration.class),
|
||||
|
||||
@@ -65,7 +65,8 @@ public class ValidationAutoConfigurationTests {
|
||||
load(SampleConfiguration.class);
|
||||
assertThat(this.context.getBean(MethodValidationPostProcessor.class))
|
||||
.isSameAs(this.context.getBean("testMethodValidationPostProcessor"));
|
||||
assertThat(this.context.getBeansOfType(MethodValidationPostProcessor.class)).hasSize(1);
|
||||
assertThat(this.context.getBeansOfType(MethodValidationPostProcessor.class))
|
||||
.hasSize(1);
|
||||
}
|
||||
|
||||
public void load(Class<?> config) {
|
||||
@@ -84,6 +85,7 @@ public class ValidationAutoConfigurationTests {
|
||||
public void doSomething(@Size(min = 3, max = 10) String name) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -28,8 +28,8 @@ import org.springframework.validation.beanvalidation.MethodValidationPostProcess
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Test for {{@link ValidationAutoConfiguration} when Hibernate validator is present
|
||||
* but no EL implementation is available.
|
||||
* Test for {@link ValidationAutoConfiguration} when Hibernate validator is present but no
|
||||
* EL implementation is available.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
|
||||
@@ -425,10 +425,8 @@ public class ServerPropertiesTests {
|
||||
map.put("server.tomcat.port-header", "x-my-forward-port");
|
||||
map.put("server.tomcat.protocol-header-https-value", "On");
|
||||
bindProperties(map);
|
||||
|
||||
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
|
||||
this.properties.customize(container);
|
||||
|
||||
assertThat(container.getEngineValves()).hasSize(1);
|
||||
Valve valve = container.getEngineValves().iterator().next();
|
||||
assertThat(valve).isInstanceOf(RemoteIpValve.class);
|
||||
@@ -445,7 +443,6 @@ public class ServerPropertiesTests {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("server.tomcat.accept-count", "10");
|
||||
bindProperties(map);
|
||||
|
||||
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
|
||||
this.properties.customize(container);
|
||||
TomcatEmbeddedServletContainer embeddedContainer = (TomcatEmbeddedServletContainer) container
|
||||
@@ -459,7 +456,6 @@ public class ServerPropertiesTests {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("server.tomcat.max-connections", "5");
|
||||
bindProperties(map);
|
||||
|
||||
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
|
||||
this.properties.customize(container);
|
||||
TomcatEmbeddedServletContainer embeddedContainer = (TomcatEmbeddedServletContainer) container
|
||||
@@ -473,7 +469,6 @@ public class ServerPropertiesTests {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("server.tomcat.max-http-post-size", "10000");
|
||||
bindProperties(map);
|
||||
|
||||
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
|
||||
this.properties.customize(container);
|
||||
TomcatEmbeddedServletContainer embeddedContainer = (TomcatEmbeddedServletContainer) container
|
||||
|
||||
@@ -60,7 +60,6 @@ public class TestDatabaseAutoConfigurationTests {
|
||||
DataSource datasource = this.context.getBean(DataSource.class);
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(datasource);
|
||||
jdbcTemplate.execute("create table example (id int, name varchar);");
|
||||
|
||||
ConfigurableApplicationContext anotherContext = doLoad(
|
||||
ExistingDataSourceConfiguration.class);
|
||||
try {
|
||||
|
||||
@@ -198,24 +198,23 @@ public class Handler extends URLStreamHandler {
|
||||
|
||||
@Override
|
||||
protected int hashCode(URL u) {
|
||||
int result = 0;
|
||||
String protocol = u.getProtocol();
|
||||
if (protocol != null) {
|
||||
result += protocol.hashCode();
|
||||
}
|
||||
String file = u.getFile();
|
||||
return hashCode(u.getProtocol(), u.getFile());
|
||||
}
|
||||
|
||||
private int hashCode(String protocol, String file) {
|
||||
int result = (protocol == null ? 0 : protocol.hashCode());
|
||||
int separatorIndex = file.indexOf(SEPARATOR);
|
||||
if (separatorIndex == -1) {
|
||||
return result + file.hashCode();
|
||||
}
|
||||
String fileWithoutEntry = file.substring(0, separatorIndex);
|
||||
String source = file.substring(0, separatorIndex);
|
||||
String entry = canonicalize(file.substring(separatorIndex + 2));
|
||||
try {
|
||||
result += new URL(fileWithoutEntry).hashCode();
|
||||
result += new URL(source).hashCode();
|
||||
}
|
||||
catch (MalformedURLException ex) {
|
||||
result += fileWithoutEntry.hashCode();
|
||||
result += source.hashCode();
|
||||
}
|
||||
String entry = canonicalize(file.substring(separatorIndex + 2));
|
||||
result += entry.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user