Browse Source

initial commit, bakery lab

Jonathan Hinds 5 years ago
parent
commit
3f6724f00b

BIN
.DS_Store View File


+ 11
- 5
pom.xml View File

14
 	<parent>
14
 	<parent>
15
 		<groupId>org.springframework.boot</groupId>
15
 		<groupId>org.springframework.boot</groupId>
16
 		<artifactId>spring-boot-starter-parent</artifactId>
16
 		<artifactId>spring-boot-starter-parent</artifactId>
17
-		<version>2.0.4.RELEASE</version>
17
+		<version>1.5.11.RELEASE</version>
18
 		<relativePath/> <!-- lookup parent from repository -->
18
 		<relativePath/> <!-- lookup parent from repository -->
19
 	</parent>
19
 	</parent>
20
 
20
 
27
 	<dependencies>
27
 	<dependencies>
28
 		<dependency>
28
 		<dependency>
29
 			<groupId>org.springframework.boot</groupId>
29
 			<groupId>org.springframework.boot</groupId>
30
-			<artifactId>spring-boot-starter</artifactId>
30
+			<artifactId>spring-boot-starter-data-jpa</artifactId>
31
 		</dependency>
31
 		</dependency>
32
 
32
 
33
 		<dependency>
33
 		<dependency>
34
 			<groupId>org.springframework.boot</groupId>
34
 			<groupId>org.springframework.boot</groupId>
35
-			<artifactId>spring-boot-starter-data-rest</artifactId>
35
+			<artifactId>spring-boot-starter-web</artifactId>
36
 		</dependency>
36
 		</dependency>
37
 
37
 
38
 		<dependency>
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
 		</dependency>
47
 		</dependency>
42
 
48
 
43
 		<dependency>
49
 		<dependency>

BIN
src/.DS_Store View File


BIN
src/main/.DS_Store View File


BIN
src/main/java/.DS_Store View File


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


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


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

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

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

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

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

1
 package com.zipcodewilmington.bakery.Models;
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
 public class Baker {
9
 public class Baker {
10
+
11
+    @Id
12
+    @GeneratedValue(strategy = GenerationType.AUTO)
4
     private Long id;
13
     private Long id;
5
 
14
 
6
     private String name;
15
     private String name;

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

1
 package com.zipcodewilmington.bakery.Models;
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
 public class Muffin {
9
 public class Muffin {
4
 
10
 
11
+    @Id
12
+    @GeneratedValue(strategy = GenerationType.AUTO)
5
     private Long id;
13
     private Long id;
6
 
14
 
7
     private String flavor;
15
     private String flavor;