File tree Expand file tree Collapse file tree 6 files changed +61
-3
lines changed
src/main/java/codeview/main Expand file tree Collapse file tree 6 files changed +61
-3
lines changed Original file line number Diff line number Diff line change 38
38
39
39
40
40
# ## SET ###
41
- ! ** /src /main /resources /application.properties
41
+ application.properties
42
+ application.yml
Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ repositories {
25
25
26
26
dependencies {
27
27
implementation ' org.springframework.boot:spring-boot-starter-data-jpa'
28
- implementation ' org.springframework.boot:spring-boot-starter-oauth2-client'
29
- implementation ' org.springframework.boot:spring-boot-starter-security'
28
+ // implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
29
+ // implementation 'org.springframework.boot:spring-boot-starter-security'
30
30
implementation ' org.springframework.boot:spring-boot-starter-web'
31
31
compileOnly ' org.projectlombok:lombok'
32
32
runtimeOnly ' com.mysql:mysql-connector-j'
Original file line number Diff line number Diff line change
1
+ package codeview .main .controller ;
2
+
3
+ import codeview .main .entity .Board ;
4
+ import codeview .main .service .BoardService ;
5
+ import lombok .RequiredArgsConstructor ;
6
+ import org .springframework .stereotype .Controller ;
7
+ import org .springframework .web .bind .annotation .PostMapping ;
8
+ import org .springframework .web .bind .annotation .RequestBody ;
9
+
10
+ @ Controller
11
+ @ RequiredArgsConstructor
12
+ public class BoardController {
13
+ private final BoardService boardService ;
14
+
15
+
16
+ @ PostMapping ("/board/write" )
17
+ public void boardSave (@ RequestBody Board board ) {
18
+ boardService .save (board );
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ package codeview .main .entity ;
2
+
3
+ import jakarta .persistence .*;
4
+ import lombok .Getter ;
5
+ import lombok .Setter ;
6
+
7
+ @ Entity
8
+ @ Getter @ Setter
9
+ public class Board {
10
+ @ Id @ GeneratedValue (strategy = GenerationType .IDENTITY ) private Long id ;
11
+ @ Column
12
+ private String title ;
13
+ }
Original file line number Diff line number Diff line change
1
+ package codeview .main .repository ;
2
+
3
+ import codeview .main .entity .Board ;
4
+ import org .springframework .data .jpa .repository .JpaRepository ;
5
+ import org .springframework .stereotype .Repository ;
6
+
7
+ @ Repository
8
+ public interface BoardRepository extends JpaRepository <Board , Long > {
9
+ }
Original file line number Diff line number Diff line change
1
+ package codeview .main .service ;
2
+
3
+ import codeview .main .entity .Board ;
4
+ import codeview .main .repository .BoardRepository ;
5
+ import lombok .RequiredArgsConstructor ;
6
+ import org .springframework .stereotype .Service ;
7
+
8
+ @ Service
9
+ @ RequiredArgsConstructor
10
+ public class BoardService {
11
+ private final BoardRepository boardRepository ;
12
+ public void save (Board board ) {
13
+ boardRepository .save (board );
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments