티스토리 뷰

반응형

오늘의 게시물은 여태까지 올렸던 간단한 스프링부트 프로젝트 최종 정리본입니다!

 
우선 제가 빠트린게 하나 있더라구요
가장 첫 화면을 제가 업로드를 안 해가지고 여기다가 하겠습니다.
 

✏ home.html

<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Hello</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel="stylesheet" th:href="@{/css/main.css}">
</head>
<body>
<h1>정푸름의 백엔드 도전기</h1>
<img th:src="@{/image/cat.jpg}">
    <a href="http://localhost:8080/login">로그인</a>
    <a href="http://localhost:8080/signup">회원가입</a>
</body>
</html>

 

✏ WebController

@GetMapping("/") // 메인화면
public String index(HttpServletRequest httpServletRequest) {
    HttpSession session = httpServletRequest.getSession();
    Optional<Object> idOptional =Optional.ofNullable(session.getAttribute("userId"));
    if(idOptional.isEmpty()){
        return "home";
    }

    return "redirect:/member/list";
}

 
 
 
기본 설정
https://pooreumjung.tistory.com/490

[Spring] 스프링부트 + JPA + thymeleaf + Spring Security로 회원가입 + 게시판(수정, 삭제, 등록, 조회, 댓글,

✏️  Build.gradleplugins { id 'java' id 'org.springframework.boot' version '3.3.2' id 'io.spring.dependency-management' version '1.1.6'}group = 'hello'version = '0.0.1-SNAPSHOT'java { toolchain { languageVersion = JavaLanguageVersion.of(22) }}repositor

pooreumjung.tistory.com

 
프로젝트 로직
https://pooreumjung.tistory.com/489

[Spring] 스프링부트 + JPA + thymeleaf + Spring Security로 회원가입 + 게시판(수정, 삭제, 등록, 조회, 댓글,

안녕하세요!최근 스프링 부트 공부를 시작해서 간단한 프로젝트를 올려보고자 합니다. 회원가입 + 로그인 + 게시판 기능(글 등록, 글 수정, 글 삭제, 댓글 달기, 댓글 보기, 좋아요 기능)을 구현스

pooreumjung.tistory.com

 
Spring Security 설정
https://pooreumjung.tistory.com/491

[Spring] 스프링부트 + JPA + thymeleaf + Spring Security로 회원가입 + 게시판(수정, 삭제, 등록, 조회, 댓글,

✏️ WebSecurityConfig 클래스@Configuration@EnableWebSecurity(debug = true)@RequiredArgsConstructorpublic class WebSecurityConfig { private final AuthenticationFilter authenticationFilter; @Bean SecurityFilterChain filterChain(HttpSecurity http) throw

pooreumjung.tistory.com

 
회원가입 구현 
https://pooreumjung.tistory.com/492

[Spring] 스프링부트 + JPA + thymeleaf + Spring Security로 회원가입 + 게시판(수정, 삭제, 등록, 조회, 댓글,

✏️  회원가입 로직기본적인 로직은 클라이언트 요청 → 컨트롤러 → 서비스 → 리포지토리 방식으로 작업이 이루어진다회원가입 입력창에서 id, name, password, confirmpassword를 입력함컨트롤러는

pooreumjung.tistory.com

 
로그인 구현
https://pooreumjung.tistory.com/493

[Spring] 스프링부트 + JPA + thymeleaf + Spring Security로 회원가입 + 게시판(수정, 삭제, 등록, 조회, 댓글,

✏️  로그인 로직로그인 창에서 아이디 + 비밀번호를 입력컨트롤러는 LoginDTO로 이 값을 받아옴컨트롤러는 멤버서비스를 통해 아이디가 존재하는지 비밀번호가 일치하는지 검사일치한다면 로

pooreumjung.tistory.com

 
메인화면 구현
https://pooreumjung.tistory.com/494

[Spring] 스프링부트 + JPA + thymeleaf + Spring Security로 회원가입 + 게시판(수정, 삭제, 등록, 조회, 댓글,

✏️ 메인화면 로직보통 로그인을 하게 되면 ~님 환영합니다를 띄어줌, 여기서도 로그인을 하면 화면에 ~님 환영합니다를 띄어줌사람들이 쓴 게시글들을 모두 볼 수 있음글쓰기 버튼을 누르면

pooreumjung.tistory.com

 
게시물 등록하기
https://pooreumjung.tistory.com/495

[Spring] 스프링부트 + JPA + thymeleaf + Spring Security로 회원가입 + 게시판(수정, 삭제, 등록, 조회, 댓글,

✏️ 게시물 등록 로직게시물 등록 화면에서 게시물의 제목과 내용을 입력할 수 있고 작성자는 화면에 띄어줌제목과 내용을 입력하면 컨트롤러가PostDTO를 통해 내용을 받아옴컨트롤러는 로그인

pooreumjung.tistory.com

 
게시물 수정하기
https://pooreumjung.tistory.com/496

[Spring] 스프링부트 + JPA + thymeleaf + Spring Security로 회원가입 + 게시판(수정, 삭제, 등록, 조회, 댓글,

✏️ 게시물 수정 로직로그인 한 유저가 자신의 게시물에서 내용만 수정할 수 있다.수정한 내용을 입력하면 컨트롤러가 UpdateDTO를 통해 게시물의 번호와 수정 내용을 받아온다.컨트롤러는 유저

pooreumjung.tistory.com

 
게시물 삭제하기
https://pooreumjung.tistory.com/497

[Spring] 스프링부트 + JPA + thymeleaf + Spring Security로 회원가입 + 게시판(수정, 삭제, 등록, 조회, 댓글,

✏️ 게시물 삭제 로직유저가 삭제하기 버튼을 누른다컨트롤러는 로그인 상태를 확인하고 로그인이 되어 있다면 boardService를 통해 게시물을 삭제한다.로그인이 되어 있지 않다면 로그인 화면으

pooreumjung.tistory.com

 
게시물에 댓글 달기
https://pooreumjung.tistory.com/498

[Spring] 스프링부트 + JPA + thymeleaf + Spring Security로 회원가입 + 게시판(수정, 삭제, 등록, 조회, 댓글,

댓글 달기 로직로그인이 되어 있고 게시물이 존재한다면 댓글 달기 화면으로 넘긴다(자신이 누구의 게시물에 댓글을 다는지 알려준다)유저는 댓글 내용만 입력할 수 있고 자신이 댓글을 달 게

pooreumjung.tistory.com

 
게시물 좋아요 누르기
https://pooreumjung.tistory.com/499

[Spring] 스프링부트 + JPA + thymeleaf + Spring Security로 회원가입 + 게시판(수정, 삭제, 등록, 조회, 댓글,

좋아요 누르기 로직로그인 한 유저는 아무 게시물에 좋아요를 누를 수 있다.한 사람이 같은 게시물에 여러 번 좋아료를 누르는 것을 방지한다.방지하는 방법은 좋아요를 한 번 누르면 좋아요 수

pooreumjung.tistory.com

 
 
마지막으로, 프로젝트가 올라가 있는 제 깃허브입니다.
혹시라도 궁금한 게 있으시거나, 틀린 부분이 있다면 댓글 달아주시면 감사하겠습니다!
https://github.com/pooreumjung/springStudy

GitHub - pooreumjung/springStudy: Studying Spring Boot

Studying Spring Boot. Contribute to pooreumjung/springStudy development by creating an account on GitHub.

github.com

 

반응형
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함