Skip to content

Commit 8b7d8b5

Browse files
author
Rajeev Kumar Singh
committed
complete app
1 parent ad7cdb6 commit 8b7d8b5

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<modelVersion>4.0.0</modelVersion>
55

66
<groupId>com.example</groupId>
7-
<artifactId>spring-boot-mysql-rest-api-tutorial</artifactId>
7+
<artifactId>easy-notes</artifactId>
88
<version>1.0.0</version>
99
<packaging>jar</packaging>
1010

11-
<name>spring-boot-mysql-rest-api-tutorial</name>
12-
<description>Building Rest API for a Simple Note taking app with Spring Boot and Mysql</description>
11+
<name>easy-notes</name>
12+
<description>Rest API for a Simple Note Taking Application</description>
1313

1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
package com.notesapp;
1+
package com.example.easynotes;
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
55
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
66

77
@SpringBootApplication
88
@EnableJpaAuditing
9-
public class NotesApplication {
9+
public class EasyNotesApplication {
1010

1111
public static void main(String[] args) {
12-
SpringApplication.run(NotesApplication.class, args);
12+
SpringApplication.run(EasyNotesApplication.class, args);
1313
}
1414
}

src/main/java/com/notesapp/controller/NoteController.java renamed to src/main/java/com/example/easynotes/controller/NoteController.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package com.notesapp.controller;
1+
package com.example.easynotes.controller;
22

3-
import com.notesapp.model.Note;
4-
import com.notesapp.repository.NoteRepository;
3+
import com.example.easynotes.model.Note;
4+
import com.example.easynotes.repository.NoteRepository;
55
import org.springframework.beans.factory.annotation.Autowired;
66
import org.springframework.http.ResponseEntity;
77
import org.springframework.web.bind.annotation.*;
@@ -39,7 +39,8 @@ public Note createNote(@Valid @RequestBody Note note) {
3939
}
4040

4141
@PutMapping("/notes/{id}")
42-
public ResponseEntity<Note> updateNote(@PathVariable(value = "id") Long noteId, @Valid @RequestBody Note noteDetails) {
42+
public ResponseEntity<Note> updateNote(@PathVariable(value = "id") Long noteId,
43+
@Valid @RequestBody Note noteDetails) {
4344
Note note = noteRepository.findOne(noteId);
4445
if(note == null) {
4546
return ResponseEntity.notFound().build();

src/main/java/com/notesapp/model/Note.java renamed to src/main/java/com/example/easynotes/model/Note.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.notesapp.model;
1+
package com.example.easynotes.model;
22

33
import org.hibernate.validator.constraints.NotBlank;
44
import org.springframework.data.annotation.CreatedDate;
@@ -19,6 +19,7 @@ public class Note {
1919
@GeneratedValue(strategy = GenerationType.AUTO)
2020
private Long id;
2121

22+
@NotBlank
2223
private String title;
2324

2425
@NotBlank

src/main/java/com/notesapp/repository/NoteRepository.java renamed to src/main/java/com/example/easynotes/repository/NoteRepository.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package com.notesapp.repository;
1+
package com.example.easynotes.repository;
22

3-
import com.notesapp.model.Note;
3+
import com.example.easynotes.model.Note;
44
import org.springframework.data.jpa.repository.JpaRepository;
55

66
/**

src/main/resources/application.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
1717
spring.jpa.hibernate.ddl-auto = update
1818

1919
## Jackson Properties
20-
spring.jackson.date-format = yyyy-MM-dd HH:mm:ss
20+
spring.jackson.date-format = yyyy-MM-dd HH:mm:ss

0 commit comments

Comments
 (0)