Sfoglia il codice sorgente

initial commit, bakery lab

Jonathan Hinds 5 anni fa
parent
commit
3f6724f00b

BIN
.DS_Store Vedi File


+ 11
- 5
pom.xml Vedi File

@@ -14,7 +14,7 @@
14 14
 	<parent>
15 15
 		<groupId>org.springframework.boot</groupId>
16 16
 		<artifactId>spring-boot-starter-parent</artifactId>
17
-		<version>2.0.4.RELEASE</version>
17
+		<version>1.5.11.RELEASE</version>
18 18
 		<relativePath/> <!-- lookup parent from repository -->
19 19
 	</parent>
20 20
 
@@ -27,17 +27,23 @@
27 27
 	<dependencies>
28 28
 		<dependency>
29 29
 			<groupId>org.springframework.boot</groupId>
30
-			<artifactId>spring-boot-starter</artifactId>
30
+			<artifactId>spring-boot-starter-data-jpa</artifactId>
31 31
 		</dependency>
32 32
 
33 33
 		<dependency>
34 34
 			<groupId>org.springframework.boot</groupId>
35
-			<artifactId>spring-boot-starter-data-rest</artifactId>
35
+			<artifactId>spring-boot-starter-web</artifactId>
36 36
 		</dependency>
37 37
 
38 38
 		<dependency>
39
-			<groupId>org.springframework.boot</groupId>
40
-			<artifactId>spring-boot-starter-web</artifactId>
39
+			<groupId>com.h2database</groupId>
40
+			<artifactId>h2</artifactId>
41
+		</dependency>
42
+
43
+		<dependency>
44
+			<groupId>org.hsqldb</groupId>
45
+			<artifactId>hsqldb</artifactId>
46
+			<scope>runtime</scope>
41 47
 		</dependency>
42 48
 
43 49
 		<dependency>

BIN
src/.DS_Store Vedi File


BIN
src/main/.DS_Store Vedi File


BIN
src/main/java/.DS_Store Vedi File


BIN
src/main/java/com/.DS_Store Vedi File


BIN
src/main/java/com/zipcodewilmington/.DS_Store Vedi File


+ 4
- 0
src/main/java/com/zipcodewilmington/bakery/Controllers/BakerController.java Vedi File

@@ -2,11 +2,15 @@ package com.zipcodewilmington.bakery.Controllers;
2 2
 
3 3
 import com.zipcodewilmington.bakery.Models.Baker;
4 4
 import com.zipcodewilmington.bakery.Repositories.BakerRepository;
5
+import org.springframework.beans.factory.annotation.Autowired;
5 6
 import org.springframework.http.HttpStatus;
6 7
 import org.springframework.http.ResponseEntity;
8
+import org.springframework.web.bind.annotation.RestController;
7 9
 
10
+@RestController
8 11
 public class BakerController {
9 12
 
13
+    @Autowired
10 14
     private BakerRepository bakerRepository;
11 15
 
12 16
     public ResponseEntity<Iterable<Baker>> index() {

+ 4
- 0
src/main/java/com/zipcodewilmington/bakery/Controllers/MuffinController.java Vedi File

@@ -2,11 +2,15 @@ package com.zipcodewilmington.bakery.Controllers;
2 2
 
3 3
 import com.zipcodewilmington.bakery.Models.Muffin;
4 4
 import com.zipcodewilmington.bakery.Repositories.MuffinRepository;
5
+import org.springframework.beans.factory.annotation.Autowired;
5 6
 import org.springframework.http.HttpStatus;
6 7
 import org.springframework.http.ResponseEntity;
8
+import org.springframework.web.bind.annotation.RestController;
7 9
 
10
+@RestController
8 11
 public class MuffinController {
9 12
 
13
+    @Autowired
10 14
     private MuffinRepository muffinRepository;
11 15
 
12 16
     public ResponseEntity<Iterable<Muffin>> index() {

+ 9
- 0
src/main/java/com/zipcodewilmington/bakery/Models/Baker.java Vedi File

@@ -1,6 +1,15 @@
1 1
 package com.zipcodewilmington.bakery.Models;
2 2
 
3
+import javax.persistence.Entity;
4
+import javax.persistence.GeneratedValue;
5
+import javax.persistence.GenerationType;
6
+import javax.persistence.Id;
7
+
8
+@Entity
3 9
 public class Baker {
10
+
11
+    @Id
12
+    @GeneratedValue(strategy = GenerationType.AUTO)
4 13
     private Long id;
5 14
 
6 15
     private String name;

+ 8
- 0
src/main/java/com/zipcodewilmington/bakery/Models/Muffin.java Vedi File

@@ -1,7 +1,15 @@
1 1
 package com.zipcodewilmington.bakery.Models;
2 2
 
3
+import javax.persistence.Entity;
4
+import javax.persistence.GeneratedValue;
5
+import javax.persistence.GenerationType;
6
+import javax.persistence.Id;
7
+
8
+@Entity
3 9
 public class Muffin {
4 10
 
11
+    @Id
12
+    @GeneratedValue(strategy = GenerationType.AUTO)
5 13
     private Long id;
6 14
 
7 15
     private String flavor;