From 62ac51eeadfb6ef04d61d5918e59fa5bf2c6125c Mon Sep 17 00:00:00 2001
From: Andy Wilkinson
Date: Wed, 7 May 2014 13:44:28 +0100
Subject: [PATCH] Upgrade to the Spring Data Dijkstra release train
In addition to the upgrade to Dijkstra (#743) Spring HATEOAS has been
upgraded to 0.11.0 (#801) and Mongo's Java driver has been upgraded to
2.12.1 (#689). In both cases this is the same version as is used by
Dijkstra RC1.
The new version of Mongo's Java driver changes the exception that's
thrown when Mongo isn't running and a connection attempt fails. The
Mongo sample has been updated accordingly.
RepositoryRestMvcAutoConfiguration has been updated to be configured
before JpaRepositoriesAutoConfiguration. This ensures that the
former's transitive import of SpringDataJacksonConfiguration takes
precedence over the latter's import of the same. This is necessary as
RepositoryRestMvcConfiguration requires a bean that's declared by
SpringDataJacksonConfiguration and, if JpaRepositoriesAutoConfiguration
is processed first, its conditions may cause the import
SpringDataJacksonConfiguration to be skipped causing instantiation
of RepositoryRestMvcConfiguration to fail.
Closes #689
Closes #743
---
.../RepositoryRestMvcAutoConfiguration.java | 5 ++++-
.../redis/RedisAutoConfiguration.java | 4 ++--
spring-boot-dependencies/pom.xml | 20 ++++---------------
.../mongo/SampleMongoApplicationTests.java | 12 +++++------
4 files changed, 16 insertions(+), 25 deletions(-)
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfiguration.java
index e284a1c034..6a23af9d65 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfiguration.java
@@ -16,10 +16,12 @@
package org.springframework.boot.autoconfigure.data.rest;
+import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
+import org.springframework.boot.autoconfigure.data.JpaRepositoriesAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
@@ -35,7 +37,7 @@ import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguratio
* Once in effect, the auto-configuration is the equivalent of importing the
* {@link RepositoryRestMvcConfiguration}.
*
- *
+ *
* @author Rob Winch
* @since 1.1.0
*/
@@ -44,6 +46,7 @@ import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguratio
@ConditionalOnMissingBean(RepositoryRestMvcConfiguration.class)
@ConditionalOnClass(RepositoryRestMvcConfiguration.class)
@Import(RepositoryRestMvcConfiguration.class)
+@AutoConfigureBefore(JpaRepositoriesAutoConfiguration.class)
public class RepositoryRestMvcAutoConfiguration {
}
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/redis/RedisAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/redis/RedisAutoConfiguration.java
index 1c696f52ea..0f4252acb0 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/redis/RedisAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/redis/RedisAutoConfiguration.java
@@ -96,10 +96,10 @@ public class RedisAutoConfiguration {
private JedisPoolConfig jedisPoolConfig() {
JedisPoolConfig config = new JedisPoolConfig();
RedisProperties.Pool props = this.properties.getPool();
- config.setMaxActive(props.getMaxActive());
+ config.setMaxTotal(props.getMaxActive());
config.setMaxIdle(props.getMaxIdle());
config.setMinIdle(props.getMinIdle());
- config.setMaxWait(props.getMaxWait());
+ config.setMaxWaitMillis(props.getMaxWait());
return config;
}
diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml
index e36fde626e..d94b606a4a 100644
--- a/spring-boot-dependencies/pom.xml
+++ b/spring-boot-dependencies/pom.xml
@@ -69,7 +69,7 @@
2.3.2
2.3.3
3.18.1-GA
- 2.1.0
+ 2.4.1
8.1.14.v20131031
2.3
1.2.0
@@ -79,7 +79,7 @@
1.2.17
1.1.2
1.9.5
- 2.11.4
+ 2.12.1
5.1.30
2.0.2
1.1.1.BUILD-SNAPSHOT
@@ -89,10 +89,8 @@
0.7-groovy-2.0
4.0.4.RELEASE
2.2.6.RELEASE
- 1.3.3.RELEASE
- 1.1.1.RELEASE
- Codd-SR2
- 0.9.0.RELEASE
+ Dijkstra-RC1
+ 0.11.0.RELEASE
4.0.0.RELEASE
1.0.0.RELEASE
1.3.2.RELEASE
@@ -885,16 +883,6 @@
spring-batch-core
${spring-batch.version}
-
- org.springframework.data
- spring-data-gemfire
- ${spring-data-gemfire.version}
-
-
- org.springframework.data
- spring-data-redis
- ${spring-data-redis.version}
-
org.springframework.data
spring-data-releasetrain
diff --git a/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java
index 00a3f5afa4..197d8eed51 100644
--- a/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java
+++ b/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java
@@ -16,18 +16,18 @@
package sample.data.mongo;
-import java.net.ConnectException;
-
import org.junit.Rule;
import org.junit.Test;
import org.springframework.boot.test.OutputCapture;
import org.springframework.core.NestedCheckedException;
+import com.mongodb.MongoServerSelectionException;
+
import static org.junit.Assert.assertTrue;
/**
* Tests for {@link SampleMongoApplication}.
- *
+ *
* @author Dave Syer
*/
public class SampleMongoApplicationTests {
@@ -54,9 +54,9 @@ public class SampleMongoApplicationTests {
@SuppressWarnings("serial")
NestedCheckedException nested = new NestedCheckedException("failed", ex) {
};
- if (nested.contains(ConnectException.class)) {
- Throwable root = nested.getRootCause();
- if (root.getMessage().contains("Connection refused")) {
+ Throwable root = nested.getRootCause();
+ if (root instanceof MongoServerSelectionException) {
+ if (root.getMessage().contains("Unable to connect to any server")) {
return true;
}
}