You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h2id="_create_a_spring_data_repository_for_fruit"><aclass="anchor" href="#_create_a_spring_data_repository_for_fruit"></a>Create a Spring Data Repository for Fruit</h2>
234
+
<h2id="_create_a_spring_data_repository_for_movie"><aclass="anchor" href="#_create_a_spring_data_repository_for_movie"></a>Create a Spring Data Repository for Movie</h2>
235
235
<divclass="sectionbody">
236
236
<divclass="paragraph">
237
-
<p>Spring Data is one of the most popular Spring APIs, so let’s create a Spring Data JPA Repository for our <code>Fruit</code> entity. Create the <code>SpringFruitRepository</code> Java class in <code>src/main/java</code> in the <code>com.redhat.developers</code> package with the following contents:</p>
237
+
<p>Spring Data is one of the most popular Spring APIs, so let’s create a Spring Data JPA Repository for our <code>Movie</code> entity. Create the <code>SpringMovieRepository</code> Java class in <code>src/main/java</code> in the <code>com.redhat.developers</code> package with the following contents:</p>
<h2id="_create_a_spring_rest_controller"><aclass="anchor" href="#_create_a_spring_rest_controller"></a>Create a Spring REST Controller</h2>
260
260
<divclass="sectionbody">
261
261
<divclass="paragraph">
262
-
<p>Now let’s create another REST endpoint for <code>Fruit</code>, but now using the Spring Web APIs. Create the <code>FruitController</code> Java class in <code>src/main/java</code> in the <code>com.redhat.developers</code> package with the following contents:</p>
262
+
<p>Now let’s create another REST endpoint for <code>Movie</code>, but now using the Spring Web APIs. Create the <code>MovieController</code> Java class in <code>src/main/java</code> in the <code>com.redhat.developers</code> package with the following contents:</p>
public FruitController(SpringFruitRepository fruitRepository) {
282
-
this.fruitRepository = fruitRepository;
281
+
public MovieController(SpringMovieRepository movieRepository) {
282
+
this.movieRepository = movieRepository;
283
283
}
284
284
285
285
@GetMapping
286
-
public List<Fruit> fruits(@RequestParam("season") String season) {
287
-
if (season != null) {
288
-
return fruitRepository.findBySeason(season);
286
+
public List<Movie> movies(@RequestParam("year") String year) {
287
+
if (year != null) {
288
+
return movieRepository.findByYear(year);
289
289
}
290
-
return fruitRepository.findAll();
290
+
return movieRepository.findAll();
291
291
}
292
292
293
293
}</code></pre>
294
294
</div>
295
295
</div>
296
296
<divclass="paragraph">
297
-
<p>Let’s try to filter only the fruits with the<strong>Summer</strong> season. Don’t forget to start Quarkus dev mode again if you stopped it.</p>
297
+
<p>Let’s try to filter only the movies with year<strong>1980</strong>. Don’t forget to start Quarkus dev mode again if you stopped it.</p>
0 commit comments