#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.
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
<name>Spring Data - Using the BOM for dependency management</name>
|
||||
|
||||
<properties>
|
||||
<spring.version>5.0.0.RELEASE</spring.version>
|
||||
<spring-data.version>Kay-RELEASE</spring-data.version>
|
||||
<spring.version>5.0.2.RELEASE</spring.version>
|
||||
<spring-data.version>Kay-SR2</spring-data.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
|
||||
@@ -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<CouchbaseOperations> couchbaseOperationsProvider;
|
||||
|
||||
@Override
|
||||
protected CouchbaseConfigurer couchbaseConfigurer() {
|
||||
return couchbaseConfigurer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an {@link IndexManager} that allows index creation.
|
||||
*
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.0.0.M6</version>
|
||||
<version>2.0.0.M7</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user