33import java .util .List ;
44import java .util .Set ;
55
6+ import org .springdoc .core .models .GroupedOpenApi ;
67import org .springframework .beans .factory .annotation .Autowired ;
78import org .springframework .boot .CommandLineRunner ;
89import org .springframework .boot .SpringApplication ;
910import org .springframework .boot .autoconfigure .SpringBootApplication ;
1011import org .springframework .context .annotation .Bean ;
1112import 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-
1914import com .redis .om .skeleton .models .Address ;
2015import com .redis .om .skeleton .models .Person ;
2116import com .redis .om .skeleton .repositories .PeopleRepository ;
2217import 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.*" )
2724public 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
0 commit comments