From 674c4e904cd9f5dca9f966b106cde35a90e64d72 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 30 Nov 2017 14:15:09 -0800 Subject: [PATCH] #325 - Upgrade to Spring Boot 2.0 M7. Tweak bom to reflect Spring Framework and Spring Data versions. Remove reactive Couchbase configuration code required prior to Spring Boot 2.0 M7. Tweak CORS examples to adapt to Spring Framework's disabled allowCredentials by default. --- bom/pom.xml | 4 ++-- .../couchbase/CouchbaseConfiguration.java | 15 ++------------- pom.xml | 2 +- .../headers/CrossOriginIntegrationTests.java | 19 ++++++------------- 4 files changed, 11 insertions(+), 29 deletions(-) diff --git a/bom/pom.xml b/bom/pom.xml index 0aaa8ecf..5172719f 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -9,8 +9,8 @@ Spring Data - Using the BOM for dependency management - 5.0.0.RELEASE - Kay-RELEASE + 5.0.2.RELEASE + Kay-SR2 diff --git a/couchbase/reactive/src/main/java/example/springdata/couchbase/CouchbaseConfiguration.java b/couchbase/reactive/src/main/java/example/springdata/couchbase/CouchbaseConfiguration.java index 8ca84fa9..55abbfa7 100644 --- a/couchbase/reactive/src/main/java/example/springdata/couchbase/CouchbaseConfiguration.java +++ b/couchbase/reactive/src/main/java/example/springdata/couchbase/CouchbaseConfiguration.java @@ -24,13 +24,9 @@ import javax.annotation.PostConstruct; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.data.couchbase.CouchbaseRepositoriesAutoConfiguration; import org.springframework.context.annotation.Bean; -import org.springframework.data.couchbase.config.AbstractReactiveCouchbaseDataConfiguration; import org.springframework.data.couchbase.config.BeanNames; -import org.springframework.data.couchbase.config.CouchbaseConfigurer; import org.springframework.data.couchbase.core.CouchbaseOperations; -import org.springframework.data.couchbase.repository.config.EnableReactiveCouchbaseRepositories; import org.springframework.data.couchbase.repository.support.IndexManager; import com.couchbase.client.java.query.N1qlQuery; @@ -40,19 +36,12 @@ import com.couchbase.client.java.query.N1qlQuery; * * @author Mark Paluch */ -@SpringBootApplication(exclude = CouchbaseRepositoriesAutoConfiguration.class) // see DATACOUCH-350 +@SpringBootApplication @RequiredArgsConstructor -@EnableReactiveCouchbaseRepositories -public class CouchbaseConfiguration extends AbstractReactiveCouchbaseDataConfiguration { +public class CouchbaseConfiguration { - private final CouchbaseConfigurer couchbaseConfigurer; private final ObjectProvider couchbaseOperationsProvider; - @Override - protected CouchbaseConfigurer couchbaseConfigurer() { - return couchbaseConfigurer; - } - /** * Create an {@link IndexManager} that allows index creation. * diff --git a/pom.xml b/pom.xml index 7cd25719..64010661 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.0.M6 + 2.0.0.M7 diff --git a/rest/headers/src/test/java/example/springdata/rest/headers/CrossOriginIntegrationTests.java b/rest/headers/src/test/java/example/springdata/rest/headers/CrossOriginIntegrationTests.java index 906c4805..8f53ec8f 100644 --- a/rest/headers/src/test/java/example/springdata/rest/headers/CrossOriginIntegrationTests.java +++ b/rest/headers/src/test/java/example/springdata/rest/headers/CrossOriginIntegrationTests.java @@ -17,7 +17,6 @@ package example.springdata.rest.headers; import static org.hamcrest.CoreMatchers.*; import static org.springframework.http.HttpHeaders.*; -import static org.springframework.restdocs.RestDocumentation.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; @@ -28,8 +27,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.mock.web.MockHttpServletResponse; -import org.springframework.restdocs.config.RestDocumentationConfigurer; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -51,22 +48,18 @@ public class CrossOriginIntegrationTests { @Before public void setUp() { - - this.mvc = MockMvcBuilders.webAppContextSetup(context).// - apply(new RestDocumentationConfigurer()).// - build(); + this.mvc = MockMvcBuilders.webAppContextSetup(context).build(); } @Test public void executeCrossOriginRequest() throws Exception { - String origin = "http://localhost"; + String origin = "http://localhost:1234"; URI uri = URI.create("/customers"); - MockHttpServletResponse response = mvc.perform(get(uri).header(ORIGIN, origin)).// - andExpect(header().string(ACCESS_CONTROL_ALLOW_CREDENTIALS, is("true"))).// - andExpect(header().string(ACCESS_CONTROL_ALLOW_ORIGIN, is(origin))).// - andDo(document("cors")).// - andReturn().getResponse(); + mvc.perform(get(uri).header(ORIGIN, origin)) // + .andExpect(status().isOk()) // + .andExpect(header().string(ACCESS_CONTROL_ALLOW_ORIGIN, is(origin))); } + }