목록Spring (82)
충분히 쌓여가는
src>java>com.enough>project>dto>ArticleListViewResponse.java 생성 @Getter public class ArticleListViewResponse { private final Long id; private final String title; private final String content; public ArticleListViewResponse(Article article) { this.id = article.getId(); this.title = article.getTitle(); this.content = article.getContent(); } } src>java>com.enough>project>controller>BlogViewControll..
엔티티 구성 컬럼명 자료형 null 허용 키 설명 id BIGINT N 기본키 기본키 title VARCHAR(255) N 제목 content VARCHAR(255) N 내용 src>main>java>com.enough.project>domain>Article.java 생성 @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Article { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id", updatable = false) private Long id; @Column(name = "title", nullable = false)..
의존성 추가 build.gradle dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6' testImplementation 'org.springframework.security:spring-security-test' } 엔티티 생성 컬럼명 자료형 null 허용 키 설명 id BIGINT N 기본키 일련번호, 기본키 email VARCHAR(255) N 이메..
src>main>java>com.enough.project>controller에 BoardController.java 생성 후 입력 package com.enough.project.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping("/board") public class BoardController { @GetMapping("/list") public String list() { ..