Sfoglia il codice sorgente

Added Maven Dependency for @Entity, @Generated, @Id

Nick Satinover 5 anni fa
parent
commit
17e646c5ac

+ 5
- 1
pom.xml Vedi File

@@ -50,7 +50,11 @@
50 50
 			<artifactId>spring-data-commons</artifactId>
51 51
 			<version>1.13.10.RELEASE</version>
52 52
 		</dependency>
53
-	</dependencies>
53
+        <dependency>
54
+            <groupId>org.springframework.boot</groupId>
55
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
56
+        </dependency>
57
+    </dependencies>
54 58
 
55 59
 	<build>
56 60
 		<plugins>

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

@@ -3,7 +3,6 @@ package com.zipcodewilmington.bakery.Controllers;
3 3
 import com.zipcodewilmington.bakery.Models.Baker;
4 4
 import com.zipcodewilmington.bakery.Repositories.BakerRepository;
5 5
 import org.springframework.beans.factory.annotation.Autowired;
6
-import org.springframework.beans.factory.annotation.Qualifier;
7 6
 import org.springframework.http.HttpStatus;
8 7
 import org.springframework.http.ResponseEntity;
9 8
 import org.springframework.web.bind.annotation.*;
@@ -11,10 +10,12 @@ import org.springframework.web.bind.annotation.*;
11 10
 @RestController
12 11
 public class BakerController {
13 12
 
14
-    @Autowired
15
-//    @Qualifier("beanBaker")
16 13
     private BakerRepository bakerRepository;
17 14
 
15
+    BakerController(@Autowired BakerRepository bakerRepository){
16
+        this.bakerRepository = bakerRepository;
17
+    }
18
+
18 19
     @GetMapping("/baker")
19 20
     public ResponseEntity<Iterable<Baker>> index() {
20 21
         return new ResponseEntity<>(this.bakerRepository.findAll(), HttpStatus.OK);

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

@@ -10,9 +10,12 @@ import org.springframework.web.bind.annotation.*;
10 10
 @RestController
11 11
 public class MuffinController {
12 12
 
13
-    @Autowired
14 13
     private MuffinRepository muffinRepository;
15 14
 
15
+    public MuffinController(@Autowired MuffinRepository muffinRepository) {
16
+        this.muffinRepository = muffinRepository;
17
+    }
18
+
16 19
     @GetMapping("/muffin")
17 20
     public ResponseEntity<Iterable<Muffin>> index() {
18 21
         return new ResponseEntity<>(this.muffinRepository.findAll(), HttpStatus.OK);