Skip to content

Commit

Permalink
spring-projects#325 - Upgrade to Spring Boot 2.0 M7.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mp911de committed Nov 30, 2017
1 parent 3d19c67 commit 674c4e9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 29 deletions.
4 changes: 2 additions & 2 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@

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;
Expand All @@ -40,19 +36,12 @@
*
* @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.
*
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

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.*;

Expand All @@ -28,8 +27,6 @@
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;
Expand All @@ -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)));
}

}

0 comments on commit 674c4e9

Please sign in to comment.