Pārlūkot izejas kodu

updated dependencies

Leon 5 gadus atpakaļ
vecāks
revīzija
1356254de5

+ 62
- 51
pom.xml Parādīt failu

1
 <?xml version="1.0" encoding="UTF-8"?>
1
 <?xml version="1.0" encoding="UTF-8"?>
2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
-	<modelVersion>4.0.0</modelVersion>
3
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
+    <modelVersion>4.0.0</modelVersion>
5
 
5
 
6
-	<groupId>com.zipcodewilmington</groupId>
7
-	<artifactId>bakery</artifactId>
8
-	<version>0.0.1-SNAPSHOT</version>
9
-	<packaging>jar</packaging>
6
+    <groupId>com.zipcodewilmington</groupId>
7
+    <artifactId>bakery</artifactId>
8
+    <version>0.0.1-SNAPSHOT</version>
9
+    <packaging>jar</packaging>
10
 
10
 
11
-	<name>bakery</name>
12
-	<description>Demo project for Spring Boot</description>
11
+    <name>bakery</name>
12
+    <description>Demo project for Spring Boot</description>
13
 
13
 
14
-	<parent>
15
-		<groupId>org.springframework.boot</groupId>
16
-		<artifactId>spring-boot-starter-parent</artifactId>
17
-		<version>2.0.4.RELEASE</version>
18
-		<relativePath/> <!-- lookup parent from repository -->
19
-	</parent>
14
+    <parent>
15
+        <groupId>org.springframework.boot</groupId>
16
+        <artifactId>spring-boot-starter-parent</artifactId>
17
+        <version>2.0.4.RELEASE</version>
18
+        <relativePath/> <!-- lookup parent from repository -->
19
+    </parent>
20
 
20
 
21
-	<properties>
22
-		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23
-		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24
-		<java.version>1.8</java.version>
25
-	</properties>
21
+    <properties>
22
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24
+        <java.version>1.8</java.version>
25
+    </properties>
26
 
26
 
27
-	<dependencies>
28
-		<dependency>
29
-			<groupId>org.springframework.boot</groupId>
30
-			<artifactId>spring-boot-starter</artifactId>
31
-		</dependency>
27
+    <dependencies>
28
+        <dependency>
29
+            <groupId>org.springframework.boot</groupId>
30
+            <artifactId>spring-boot-starter</artifactId>
31
+        </dependency>
32
 
32
 
33
-		<dependency>
34
-			<groupId>org.springframework.boot</groupId>
35
-			<artifactId>spring-boot-starter-data-rest</artifactId>
36
-		</dependency>
33
+        <dependency>
34
+            <groupId>org.springframework.boot</groupId>
35
+            <artifactId>spring-boot-starter-data-rest</artifactId>
36
+        </dependency>
37
 
37
 
38
-		<dependency>
39
-			<groupId>org.springframework.boot</groupId>
40
-			<artifactId>spring-boot-starter-web</artifactId>
41
-		</dependency>
38
+        <dependency>
39
+            <groupId>org.springframework.boot</groupId>
40
+            <artifactId>spring-boot-starter-web</artifactId>
41
+        </dependency>
42
 
42
 
43
-		<dependency>
44
-			<groupId>org.springframework.boot</groupId>
45
-			<artifactId>spring-boot-starter-test</artifactId>
46
-			<scope>test</scope>
47
-		</dependency>
48
-		<dependency>
49
-			<groupId>org.springframework.data</groupId>
50
-			<artifactId>spring-data-commons</artifactId>
51
-			<version>1.13.10.RELEASE</version>
52
-		</dependency>
53
-	</dependencies>
43
+        <dependency>
44
+            <groupId>org.springframework.boot</groupId>
45
+            <artifactId>spring-boot-starter-test</artifactId>
46
+            <scope>test</scope>
47
+        </dependency>
48
+        <dependency>
49
+            <groupId>org.springframework.data</groupId>
50
+            <artifactId>spring-data-commons</artifactId>
51
+        </dependency>
52
+        <dependency>
53
+            <groupId>org.springframework.boot</groupId>
54
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
55
+        </dependency>
56
+        <dependency>
57
+            <groupId>com.h2database</groupId>
58
+            <artifactId>h2</artifactId>
59
+        </dependency>
60
+        <dependency>
61
+            <groupId>org.springframework.boot</groupId>
62
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
63
+        </dependency>
64
+    </dependencies>
54
 
65
 
55
-	<build>
56
-		<plugins>
57
-			<plugin>
58
-				<groupId>org.springframework.boot</groupId>
59
-				<artifactId>spring-boot-maven-plugin</artifactId>
60
-			</plugin>
61
-		</plugins>
62
-	</build>
66
+    <build>
67
+        <plugins>
68
+            <plugin>
69
+                <groupId>org.springframework.boot</groupId>
70
+                <artifactId>spring-boot-maven-plugin</artifactId>
71
+            </plugin>
72
+        </plugins>
73
+    </build>
63
 
74
 
64
 
75
 
65
 </project>
76
 </project>

+ 3
- 4
src/main/java/com/zipcodewilmington/bakery/Controllers/BakerController.java Parādīt failu

6
 import org.springframework.http.ResponseEntity;
6
 import org.springframework.http.ResponseEntity;
7
 
7
 
8
 public class BakerController {
8
 public class BakerController {
9
-
10
     private BakerRepository bakerRepository;
9
     private BakerRepository bakerRepository;
11
 
10
 
12
     public ResponseEntity<Iterable<Baker>> index() {
11
     public ResponseEntity<Iterable<Baker>> index() {
14
     }
13
     }
15
 
14
 
16
     public ResponseEntity<Baker> show(Long id) {
15
     public ResponseEntity<Baker> show(Long id) {
17
-        return new ResponseEntity<>(this.bakerRepository.findOne(id), HttpStatus.OK);
16
+        return new ResponseEntity<>(this.bakerRepository.findById(id).get(), HttpStatus.OK);
18
     }
17
     }
19
 
18
 
20
     public ResponseEntity<Baker> create(Baker baker) {
19
     public ResponseEntity<Baker> create(Baker baker) {
22
     }
21
     }
23
 
22
 
24
     public ResponseEntity<Baker> update(Long id, Baker baker) {
23
     public ResponseEntity<Baker> update(Long id, Baker baker) {
25
-        Baker foundBaker = bakerRepository.findOne(id);
24
+        Baker foundBaker = bakerRepository.findById(id).get();
26
 
25
 
27
         foundBaker.setName(baker.getName());
26
         foundBaker.setName(baker.getName());
28
         foundBaker.setSpecialty(baker.getSpecialty());
27
         foundBaker.setSpecialty(baker.getSpecialty());
31
     }
30
     }
32
 
31
 
33
     public ResponseEntity<Boolean> destroy(Long id) {
32
     public ResponseEntity<Boolean> destroy(Long id) {
34
-        this.bakerRepository.delete(id);
33
+        this.bakerRepository.findById(id).get();
35
         return new ResponseEntity<>(true, HttpStatus.OK);
34
         return new ResponseEntity<>(true, HttpStatus.OK);
36
     }
35
     }
37
 }
36
 }

+ 3
- 3
src/main/java/com/zipcodewilmington/bakery/Controllers/MuffinController.java Parādīt failu

14
     }
14
     }
15
 
15
 
16
     public ResponseEntity<Muffin> show(Long id) {
16
     public ResponseEntity<Muffin> show(Long id) {
17
-        return new ResponseEntity<>(this.muffinRepository.findOne(id), HttpStatus.OK);
17
+        return new ResponseEntity<>(this.muffinRepository.findById(id).get(), HttpStatus.OK);
18
     }
18
     }
19
 
19
 
20
     public ResponseEntity<Muffin> create(Muffin muffin) {
20
     public ResponseEntity<Muffin> create(Muffin muffin) {
22
     }
22
     }
23
 
23
 
24
     public ResponseEntity<Muffin> update(Long id, Muffin muffin) {
24
     public ResponseEntity<Muffin> update(Long id, Muffin muffin) {
25
-        Muffin foundMuffin = muffinRepository.findOne(id);
25
+        Muffin foundMuffin = muffinRepository.findById(id).get();
26
         foundMuffin.setFlavor(muffin.getFlavor());
26
         foundMuffin.setFlavor(muffin.getFlavor());
27
 
27
 
28
         return new ResponseEntity<>(this.muffinRepository.save(foundMuffin), HttpStatus.OK);
28
         return new ResponseEntity<>(this.muffinRepository.save(foundMuffin), HttpStatus.OK);
29
     }
29
     }
30
 
30
 
31
     public ResponseEntity<Boolean> destroy(Long id) {
31
     public ResponseEntity<Boolean> destroy(Long id) {
32
-        this.muffinRepository.delete(id);
32
+        this.muffinRepository.deleteById(id);
33
         return new ResponseEntity<>(true, HttpStatus.OK);
33
         return new ResponseEntity<>(true, HttpStatus.OK);
34
     }
34
     }
35
 
35
 

+ 0
- 1
src/main/java/com/zipcodewilmington/bakery/Models/Muffin.java Parādīt failu

1
 package com.zipcodewilmington.bakery.Models;
1
 package com.zipcodewilmington.bakery.Models;
2
 
2
 
3
 public class Muffin {
3
 public class Muffin {
4
-
5
     private Long id;
4
     private Long id;
6
 
5
 
7
     private String flavor;
6
     private String flavor;

+ 1
- 0
src/main/java/com/zipcodewilmington/bakery/Repositories/BakerRepository.java Parādīt failu

2
 
2
 
3
 import com.zipcodewilmington.bakery.Models.Baker;
3
 import com.zipcodewilmington.bakery.Models.Baker;
4
 import org.springframework.data.repository.CrudRepository;
4
 import org.springframework.data.repository.CrudRepository;
5
+import org.springframework.stereotype.Repository;
5
 
6
 
6
 public interface BakerRepository extends CrudRepository<Baker, Long> {
7
 public interface BakerRepository extends CrudRepository<Baker, Long> {
7
 }
8
 }

+ 1
- 0
src/main/java/com/zipcodewilmington/bakery/Repositories/MuffinRepository.java Parādīt failu

2
 
2
 
3
 import com.zipcodewilmington.bakery.Models.Muffin;
3
 import com.zipcodewilmington.bakery.Models.Muffin;
4
 import org.springframework.data.repository.CrudRepository;
4
 import org.springframework.data.repository.CrudRepository;
5
+import org.springframework.stereotype.Repository;
5
 
6
 
6
 public interface MuffinRepository extends CrudRepository<Muffin, Long> {
7
 public interface MuffinRepository extends CrudRepository<Muffin, Long> {
7
 }
8
 }