File tree Expand file tree Collapse file tree 4 files changed +77
-0
lines changed Expand file tree Collapse file tree 4 files changed +77
-0
lines changed Original file line number Diff line number Diff line change 3333 <artifactId >spring-boot-starter-jdbc</artifactId >
3434 </dependency >
3535
36+ <dependency >
37+ <groupId >org.avaje.ebeanorm</groupId >
38+ <artifactId >avaje-ebeanorm</artifactId >
39+ <version >7.18.1</version >
40+ </dependency >
41+ <dependency >
42+ <groupId >org.avaje.ebeanorm</groupId >
43+ <artifactId >querybean-generator</artifactId >
44+ <version >2.3.1</version >
45+ <scope >provided</scope >
46+ </dependency >
47+ <dependency >
48+ <groupId >org.avaje.ebeanorm</groupId >
49+ <artifactId >avaje-ebeanorm-querybean</artifactId >
50+ <version >7.15.1</version >
51+ </dependency >
52+
3653 <dependency >
3754 <groupId >com.h2database</groupId >
3855 <artifactId >h2</artifactId >
4461 <artifactId >spring-boot-starter-test</artifactId >
4562 <scope >test</scope >
4663 </dependency >
64+ <dependency >
65+ <groupId >org.avaje.composite</groupId >
66+ <artifactId >avaje-composite-testing-ebean</artifactId >
67+ <version >4.1</version >
68+ <type >pom</type >
69+ <scope >test</scope >
70+ </dependency >
4771 </dependencies >
4872
4973 <build >
Original file line number Diff line number Diff line change 1+ package com .example ;
2+
3+ import com .example .model .Pizza ;
4+ import org .springframework .web .bind .annotation .GetMapping ;
5+ import org .springframework .web .bind .annotation .PostMapping ;
6+ import org .springframework .web .bind .annotation .RequestBody ;
7+ import org .springframework .web .bind .annotation .RestController ;
8+
9+ import java .util .List ;
10+
11+ @ RestController
12+ public class PizzaController {
13+ private final PizzaRepository pizzaRepository ;
14+
15+ public PizzaController (PizzaRepository pizzaRepository ) {
16+ this .pizzaRepository = pizzaRepository ;
17+ }
18+
19+ @ GetMapping
20+ List <Pizza > list () {
21+ return pizzaRepository .findOrderByIdAsc ();
22+ }
23+
24+ @ PostMapping
25+ Pizza add (@ RequestBody Pizza pizza ) {
26+ return pizzaRepository .save (pizza );
27+ }
28+ }
Original file line number Diff line number Diff line change 1+ package com .example ;
2+
3+ import java .util .ArrayList ;
4+ import java .util .List ;
5+
6+ import org .springframework .stereotype .Repository ;
7+
8+ import com .example .model .Pizza ;
9+
10+ @ Repository
11+ public class PizzaRepository {
12+
13+ public List <Pizza > findOrderByIdAsc () {
14+ List <Pizza > pizzas = new ArrayList <>();
15+ return pizzas ;
16+ }
17+
18+ public Pizza save (Pizza pizza ) {
19+ return pizza ;
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ datasource.db.databaseUrl =jdbc:h2:mem:testdb; DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
2+ datasource.db.databaseDriver =org.h2.Driver
3+ datasource.db.username =sa
4+ datasource.db.password =
You can’t perform that action at this time.
0 commit comments