Skip to content

Commit 39a1b0d

Browse files
committed
upgrade to redis-om-spring 0.8.0-SNAPSHOT and Spring 3.x
1 parent 3734e7a commit 39a1b0d

File tree

5 files changed

+66
-35
lines changed

5 files changed

+66
-35
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ spring.redis.password=5uper53cret
235235

236236
## 📝 Prerequisites
237237

238-
* Java 11 or higher
239-
* Spring Boot 2.6.4 (included by Redis OM Spring)
238+
* Java 17 or higher
239+
* Spring Boot 3.0.2
240240
* A [Redis](https://redis.io) database with the [RediSearch](https://redisearch.io) module version TODO or higher installed. We've provided a `docker-compose.yml` with Redis Stack for this. You can also [sign up for a free 30Mb database with Redis Enterprise Cloud](https://redis.com/try-free/) - be sure to check the box to configure a Redis Stack instance, follow [this guide](https://developer.redis.com/create/rediscloud/).
241241
* [curl](https://curl.se/), or [Postman](https://www.postman.com/) - to send HTTP requests to the application. We'll provide examples using curl in this document.
242242
* Optional: [RedisInsight](https://redis.com/redis-enterprise/redis-insight/), a free data visualization and database management tool for Redis. When downloading RedisInsight, be sure to select version 2.x.
@@ -249,4 +249,4 @@ spring.redis.password=5uper53cret
249249

250250
### 🧭Interact with the API
251251

252-
You can interact with the API directly with CURL or through the [Swagger interface](http://localhost:8080/swagger-ui/).
252+
You can interact with the API directly with CURL or through the [Swagger interface](http://localhost:8080/swagger-ui/index.html).

docs/01_app_walkthrough.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# 🍀 Redis OM Spring Skeleton App
2+
3+
## What is this?
4+
5+
## Creating the application
6+
7+
## Adding Redis OM Spring Dependencies
8+
9+
## Enabling Document Repositories
10+
11+
## Creating the models
12+
13+
## Creating the repositories
14+
15+
## Loading some seed data
16+
17+
## Exploring the data with RedisInsight
18+
19+
## Custom querying with Spring Repositories
20+
21+
## Adding a controller
22+
23+
## Testing our endpoints with Postman
24+
25+
## Using Entity Streams for Querying
26+
27+
### Create a service class
28+
29+
### Testing Entity Streams

pom.xml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>2.6.4</version>
9+
<version>3.0.2</version>
1010
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212
<groupId>com.redis.om</groupId>
@@ -15,7 +15,7 @@
1515
<name>skeleton</name>
1616
<description>Skeleton App for Redis OM Spring</description>
1717
<properties>
18-
<java.version>11</java.version>
18+
<java.version>17</java.version>
1919
</properties>
2020
<dependencies>
2121
<dependency>
@@ -25,7 +25,7 @@
2525
<dependency>
2626
<groupId>com.redis.om</groupId>
2727
<artifactId>redis-om-spring</artifactId>
28-
<version>0.3.0-SNAPSHOT</version>
28+
<version>0.8.0-SNAPSHOT</version>
2929
</dependency>
3030

3131
<dependency>
@@ -40,14 +40,9 @@
4040
<optional>true</optional>
4141
</dependency>
4242
<dependency>
43-
<groupId>io.springfox</groupId>
44-
<artifactId>springfox-boot-starter</artifactId>
45-
<version>3.0.0</version>
46-
</dependency>
47-
<dependency>
48-
<groupId>io.springfox</groupId>
49-
<artifactId>springfox-swagger-ui</artifactId>
50-
<version>3.0.0</version>
43+
<groupId>org.springdoc</groupId>
44+
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
45+
<version>2.0.2</version>
5146
</dependency>
5247
<dependency>
5348
<groupId>org.springframework.boot</groupId>
@@ -80,4 +75,4 @@
8075
</plugins>
8176
</build>
8277

83-
</project>
78+
</project>

src/main/java/com/redis/om/skeleton/SkeletonApplication.java

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,23 @@
33
import java.util.List;
44
import java.util.Set;
55

6+
import org.springdoc.core.models.GroupedOpenApi;
67
import org.springframework.beans.factory.annotation.Autowired;
78
import org.springframework.boot.CommandLineRunner;
89
import org.springframework.boot.SpringApplication;
910
import org.springframework.boot.autoconfigure.SpringBootApplication;
1011
import org.springframework.context.annotation.Bean;
1112
import org.springframework.data.geo.Point;
1213

13-
import springfox.documentation.builders.PathSelectors;
14-
import springfox.documentation.builders.RequestHandlerSelectors;
15-
import springfox.documentation.spi.DocumentationType;
16-
import springfox.documentation.spring.web.plugins.Docket;
17-
import springfox.documentation.swagger2.annotations.EnableSwagger2;
18-
1914
import com.redis.om.skeleton.models.Address;
2015
import com.redis.om.skeleton.models.Person;
2116
import com.redis.om.skeleton.repositories.PeopleRepository;
2217
import com.redis.om.spring.annotations.EnableRedisDocumentRepositories;
2318

19+
import io.swagger.v3.oas.models.OpenAPI;
20+
import io.swagger.v3.oas.models.info.Info;
21+
2422
@SpringBootApplication
25-
@EnableSwagger2
2623
@EnableRedisDocumentRepositories(basePackages = "com.redis.om.skeleton.*")
2724
public class SkeletonApplication {
2825

@@ -45,7 +42,7 @@ CommandLineRunner loadTestData(PeopleRepository repo) {
4542
Address thorsAddress = Address.of("248", "Seven Mile Beach Rd", "Broken Head", "NSW", "2481", "Australia");
4643

4744
// 11 Commerce Dr, Riverhead, NY 11901
48-
Address ironmansAddress = Address.of("11", "Commerce Dr", "Riverhead", "NY", "11901", "US");
45+
Address ironmansAddress = Address.of("11", "Commerce Dr", "Riverhead", "NY", "11901", "US");
4946

5047
// 605 W 48th St, New York, NY 10019
5148
Address blackWidowAddress = Address.of("605", "48th St", "New York", "NY", "10019", "US");
@@ -59,23 +56,33 @@ CommandLineRunner loadTestData(PeopleRepository repo) {
5956
// 11461 Sunset Blvd, Los Angeles, CA 90049
6057
Address nickFuryAddress = Address.of("11461", "Sunset Blvd", "Los Angeles", "CA", "90049", "US");
6158

62-
Person thor = Person.of("Chris", "Hemsworth", 38, thorSays, new Point(153.616667, -28.716667), thorsAddress, Set.of("hammer", "biceps", "hair", "heart"));
63-
Person ironman = Person.of("Robert", "Downey", 56, ironmanSays, new Point(40.9190747, -72.5371874), ironmansAddress, Set.of("tech", "money", "one-liners", "intelligence", "resources"));
64-
Person blackWidow = Person.of("Scarlett", "Johansson", 37, blackWidowSays, new Point(40.7215259, -74.0129994), blackWidowAddress, Set.of("deception", "martial_arts"));
65-
Person wandaMaximoff = Person.of("Elizabeth", "Olsen", 32, wandaMaximoffSays, new Point(40.6976701, -74.2598641), wandaMaximoffsAddress, Set.of("magic", "loyalty"));
66-
Person gamora = Person.of("Zoe", "Saldana", 43, gamoraSays, new Point(-118.399968, 34.073087), gamorasAddress, Set.of("skills", "martial_arts"));
67-
Person nickFury = Person.of("Samuel L.", "Jackson", 73, nickFurySays, new Point(-118.4345534, 34.082615), nickFuryAddress, Set.of("planning", "deception", "resources"));
59+
Person thor = Person.of("Chris", "Hemsworth", 38, thorSays, new Point(153.616667, -28.716667), thorsAddress,
60+
Set.of("hammer", "biceps", "hair", "heart"));
61+
Person ironman = Person.of("Robert", "Downey", 56, ironmanSays, new Point(40.9190747, -72.5371874),
62+
ironmansAddress, Set.of("tech", "money", "one-liners", "intelligence", "resources"));
63+
Person blackWidow = Person.of("Scarlett", "Johansson", 37, blackWidowSays, new Point(40.7215259, -74.0129994),
64+
blackWidowAddress, Set.of("deception", "martial_arts"));
65+
Person wandaMaximoff = Person.of("Elizabeth", "Olsen", 32, wandaMaximoffSays, new Point(40.6976701, -74.2598641),
66+
wandaMaximoffsAddress, Set.of("magic", "loyalty"));
67+
Person gamora = Person.of("Zoe", "Saldana", 43, gamoraSays, new Point(-118.399968, 34.073087), gamorasAddress,
68+
Set.of("skills", "martial_arts"));
69+
Person nickFury = Person.of("Samuel L.", "Jackson", 73, nickFurySays, new Point(-118.4345534, 34.082615),
70+
nickFuryAddress, Set.of("planning", "deception", "resources"));
6871

6972
repo.saveAll(List.of(thor, ironman, blackWidow, wandaMaximoff, gamora, nickFury));
7073
};
7174
}
7275

7376
@Bean
74-
public Docket api() {
75-
return new Docket(DocumentationType.SWAGGER_2)
76-
.select()
77-
.apis(RequestHandlerSelectors.any())
78-
.paths(PathSelectors.any())
77+
public OpenAPI apiInfo() {
78+
return new OpenAPI().info(new Info().title("Redis OM Spring Skeleton").version("1.0.0"));
79+
}
80+
81+
@Bean
82+
public GroupedOpenApi httpApi() {
83+
return GroupedOpenApi.builder()
84+
.group("http")
85+
.pathsToMatch("/**")
7986
.build();
8087
}
8188

src/main/java/com/redis/om/skeleton/services/PeopleService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import com.redis.om.skeleton.models.Person$;
1212
import com.redis.om.spring.search.stream.EntityStream;
1313

14-
import io.redisearch.aggregation.SortedField.SortOrder;
14+
import redis.clients.jedis.search.aggr.SortedField.SortOrder;
1515

1616
@Service
1717
public class PeopleService {

0 commit comments

Comments
 (0)