@@ -32,7 +32,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.data.geo.Point;
|
||||
import org.springframework.data.mongodb.core.MongoOperations;
|
||||
import org.springframework.data.mongodb.core.index.IndexDefinition;
|
||||
import org.springframework.data.mongodb.core.index.IndexResolver;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -53,8 +52,7 @@ public class StoreInitializer {
|
||||
return;
|
||||
}
|
||||
|
||||
var indexDefinitions = IndexResolver
|
||||
.create(operations.getConverter().getMappingContext())
|
||||
var indexDefinitions = IndexResolver.create(operations.getConverter().getMappingContext())
|
||||
.resolveIndexFor(Store.class);
|
||||
|
||||
indexDefinitions.forEach(operations.indexOps(Store.class)::ensureIndex);
|
||||
|
||||
@@ -22,13 +22,10 @@ import example.springdata.rest.stores.StoreRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.geo.Distance;
|
||||
import org.springframework.data.geo.Metrics;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Random port for embedded MongoDB
|
||||
spring.data.mongodb.port=0
|
||||
|
||||
# Spring Data REST
|
||||
spring.data.rest.base-path=/api
|
||||
|
||||
@@ -97,7 +97,6 @@ class StarbucksClient {
|
||||
forEach(store -> log.info("{} - {}", store.name, store.address));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void accessServiceUsingRestTemplate() {
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package example.springdata.rest.stores;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import example.springdata.rest.stores.Store.Address;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -22,16 +24,14 @@ import java.util.UUID;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.geo.Distance;
|
||||
import org.springframework.data.geo.Metrics;
|
||||
import org.springframework.data.geo.Point;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link StoreRepository}.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user