Commit 5ed00b35 authored by Phillip Webb's avatar Phillip Webb

Merge branch '1.4.x' into 1.5.x

parents 9fdb563d 357d072a
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
<main.basedir>${basedir}/..</main.basedir> <main.basedir>${basedir}/..</main.basedir>
</properties> </properties>
<dependencies> <dependencies>
<!-- Compile -->
<dependency> <dependency>
<groupId>org.springframework.hateoas</groupId> <groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId> <artifactId>spring-hateoas</artifactId>
</dependency> </dependency>
<!-- Provided --> <!-- Provided -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
......
...@@ -49,8 +49,7 @@ import org.springframework.context.annotation.Primary; ...@@ -49,8 +49,7 @@ import org.springframework.context.annotation.Primary;
public class CouchbaseAutoConfiguration { public class CouchbaseAutoConfiguration {
@Configuration @Configuration
@ConditionalOnMissingBean(value = CouchbaseConfiguration.class, @ConditionalOnMissingBean(value = CouchbaseConfiguration.class, type = "org.springframework.data.couchbase.config.CouchbaseConfigurer")
type = "org.springframework.data.couchbase.config.CouchbaseConfigurer")
public static class CouchbaseConfiguration { public static class CouchbaseConfiguration {
private final CouchbaseProperties properties; private final CouchbaseProperties properties;
...@@ -124,8 +123,9 @@ public class CouchbaseAutoConfiguration { ...@@ -124,8 +123,9 @@ public class CouchbaseAutoConfiguration {
* Determine if Couchbase should be configured. This happens if either the * Determine if Couchbase should be configured. This happens if either the
* user-configuration defines a {@code CouchbaseConfigurer} or if at least the * user-configuration defines a {@code CouchbaseConfigurer} or if at least the
* "bootstrapHosts" property is specified. * "bootstrapHosts" property is specified.
* <p>The reason why we check for the presence of {@code CouchbaseConfigurer} is * <p>
* that it might use {@link CouchbaseProperties} for its internal customization. * 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 { static class CouchbaseCondition extends AnyNestedCondition {
......
...@@ -53,7 +53,6 @@ public class ConditionalOnMissingBeanWithFilteredClasspathTests { ...@@ -53,7 +53,6 @@ public class ConditionalOnMissingBeanWithFilteredClasspathTests {
assertThat(this.context.containsBean("foo")).isTrue(); assertThat(this.context.containsBean("foo")).isTrue();
} }
@Configuration @Configuration
static class OnBeanTypeConfiguration { static class OnBeanTypeConfiguration {
...@@ -66,6 +65,7 @@ public class ConditionalOnMissingBeanWithFilteredClasspathTests { ...@@ -66,6 +65,7 @@ public class ConditionalOnMissingBeanWithFilteredClasspathTests {
} }
static class TestCacheManager extends CaffeineCacheManager { static class TestCacheManager extends CaffeineCacheManager {
} }
} }
...@@ -60,7 +60,6 @@ public class TestDatabaseAutoConfigurationTests { ...@@ -60,7 +60,6 @@ public class TestDatabaseAutoConfigurationTests {
DataSource datasource = this.context.getBean(DataSource.class); DataSource datasource = this.context.getBean(DataSource.class);
JdbcTemplate jdbcTemplate = new JdbcTemplate(datasource); JdbcTemplate jdbcTemplate = new JdbcTemplate(datasource);
jdbcTemplate.execute("create table example (id int, name varchar);"); jdbcTemplate.execute("create table example (id int, name varchar);");
ConfigurableApplicationContext anotherContext = doLoad( ConfigurableApplicationContext anotherContext = doLoad(
ExistingDataSourceConfiguration.class); ExistingDataSourceConfiguration.class);
try { try {
......
...@@ -198,24 +198,23 @@ public class Handler extends URLStreamHandler { ...@@ -198,24 +198,23 @@ public class Handler extends URLStreamHandler {
@Override @Override
protected int hashCode(URL u) { protected int hashCode(URL u) {
int result = 0; return hashCode(u.getProtocol(), u.getFile());
String protocol = u.getProtocol();
if (protocol != null) {
result += protocol.hashCode();
} }
String file = u.getFile();
private int hashCode(String protocol, String file) {
int result = (protocol == null ? 0 : protocol.hashCode());
int separatorIndex = file.indexOf(SEPARATOR); int separatorIndex = file.indexOf(SEPARATOR);
if (separatorIndex == -1) { if (separatorIndex == -1) {
return result + file.hashCode(); return result + file.hashCode();
} }
String fileWithoutEntry = file.substring(0, separatorIndex); String source = file.substring(0, separatorIndex);
String entry = canonicalize(file.substring(separatorIndex + 2));
try { try {
result += new URL(fileWithoutEntry).hashCode(); result += new URL(source).hashCode();
} }
catch (MalformedURLException ex) { catch (MalformedURLException ex) {
result += fileWithoutEntry.hashCode(); result += source.hashCode();
} }
String entry = canonicalize(file.substring(separatorIndex + 2));
result += entry.hashCode(); result += entry.hashCode();
return result; return result;
} }
......
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