Skip to content

Commit c6a0e2e

Browse files
committed
Cleanup SD REST Starbucks example.
1 parent f14747a commit c6a0e2e

File tree

6 files changed

+11
-14
lines changed

6 files changed

+11
-14
lines changed

rest/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<description>Sample projects for Spring Data REST</description>
1616

1717
<modules>
18-
<!-- <module>starbucks</module> -->
18+
<module>starbucks</module>
1919
<!-- <module>multi-store</module> -->
2020
<module>projections</module>
2121
<module>security</module>

rest/starbucks/pom.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<dependency>
2323
<groupId>de.flapdoodle.embed</groupId>
2424
<artifactId>de.flapdoodle.embed.mongo</artifactId>
25+
<version>4.16.2</version>
2526
<scope>runtime</scope>
2627
</dependency>
2728

@@ -69,14 +70,14 @@
6970
<dependency>
7071
<groupId>org.webjars</groupId>
7172
<artifactId>jquery</artifactId>
72-
<version>2.1.3</version>
73+
<version>3.7.1</version>
7374
<scope>runtime</scope>
7475
</dependency>
7576

7677
<dependency>
7778
<groupId>org.webjars</groupId>
7879
<artifactId>bootstrap</artifactId>
79-
<version>3.3.4</version>
80+
<version>5.3.3</version>
8081
<scope>runtime</scope>
8182
</dependency>
8283

rest/starbucks/src/main/java/example/springdata/rest/stores/StoreInitializer.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.springframework.batch.item.file.mapping.DefaultLineMapper;
2929
import org.springframework.batch.item.file.separator.DefaultRecordSeparatorPolicy;
3030
import org.springframework.batch.item.file.transform.DelimitedLineTokenizer;
31-
import org.springframework.beans.factory.annotation.Autowired;
3231
import org.springframework.core.io.ClassPathResource;
3332
import org.springframework.data.geo.Point;
3433
import org.springframework.data.mongodb.core.MongoOperations;
@@ -45,7 +44,6 @@
4544
@Component
4645
public class StoreInitializer {
4746

48-
@Autowired
4947
public StoreInitializer(StoreRepository repository, MongoOperations operations) throws Exception {
5048

5149
if (repository.count() != 0) {
@@ -64,8 +62,8 @@ public StoreInitializer(StoreRepository repository, MongoOperations operations)
6462
}
6563

6664
/**
67-
* Reads a file {@code starbucks.csv} from the class path and parses it into {@link Store} instances about to
68-
* be persisted.
65+
* Reads a file {@code starbucks.csv} from the class path and parses it into {@link Store} instances about to be
66+
* persisted.
6967
*
7068
* @return
7169
* @throws Exception

rest/starbucks/src/main/java/example/springdata/rest/stores/StoreRepository.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
2525
import org.springframework.data.querydsl.binding.QuerydslBindings;
2626
import org.springframework.data.querydsl.binding.SingleValueBinding;
27+
import org.springframework.data.repository.CrudRepository;
2728
import org.springframework.data.repository.PagingAndSortingRepository;
2829
import org.springframework.data.rest.core.annotation.RestResource;
2930

@@ -36,7 +37,8 @@
3637
*
3738
* @author Oliver Gierke
3839
*/
39-
public interface StoreRepository extends PagingAndSortingRepository<Store, UUID>, QuerydslPredicateExecutor<Store> {
40+
public interface StoreRepository
41+
extends CrudRepository<Store, UUID>, PagingAndSortingRepository<Store, UUID>, QuerydslPredicateExecutor<Store> {
4042

4143
@RestResource(rel = "by-location")
4244
Page<Store> findByAddressLocationNear(Point location, Distance distance, Pageable pageable);
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
# Random port for embedded MongoDB
2-
spring.data.mongodb.port=0
3-
spring.mongodb.embedded.version=3.6.0
41
# Spring Data REST
52
spring.data.rest.base-path=/api

rest/starbucks/src/test/java/example/springdata/rest/stores/StarbucksClient.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import org.springframework.boot.autoconfigure.SpringBootApplication;
3030
import org.springframework.boot.test.context.SpringBootTest;
3131
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
32-
import org.springframework.boot.web.server.LocalServerPort;
32+
import org.springframework.boot.test.web.server.LocalServerPort;
3333
import org.springframework.context.annotation.Bean;
3434
import org.springframework.hateoas.EntityModel;
3535
import org.springframework.hateoas.MediaTypes;
@@ -126,8 +126,7 @@ public String toString() {
126126
return String.format("%s, %s %s - lat: %s, long: %s", street, zip, city, location.y, location.x);
127127
}
128128

129-
record Location(double x, double y) {
130-
}
129+
record Location(double x, double y) {}
131130
}
132131
}
133132
}

0 commit comments

Comments
 (0)