Skip to content

Commit ad758c3

Browse files
committed
add dependencies and properties
1 parent 866f3b4 commit ad758c3

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

demo-ebean/pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,23 @@
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>
@@ -44,6 +61,13 @@
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>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
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=

0 commit comments

Comments
 (0)