Skip to content

Commit

Permalink
verson: spring version 3.1.3 > 3.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsong111 committed Mar 10, 2024
1 parent e4eaf81 commit 4cffde5
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 145 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
.idea/

# User-specific stuff
.idea/**/workspace.xml
Expand Down
61 changes: 39 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,44 +1,61 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id 'org.springframework.boot' version '3.1.3'
id 'io.spring.dependency-management' version '1.1.3'
id 'org.jetbrains.kotlin.jvm' version '1.8.22'
id 'org.jetbrains.kotlin.plugin.spring' version '1.8.22'
id 'org.jetbrains.kotlin.plugin.jpa' version '1.8.22'
id 'org.springframework.boot' version '3.2.3'
id 'io.spring.dependency-management' version '1.1.4'
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
id 'org.jetbrains.kotlin.plugin.spring' version '1.9.22'
id 'org.jetbrains.kotlin.plugin.jpa' version '1.9.22'
}

group = 'com.namju'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '17'
sourceCompatibility = '17'
}

repositories {
mavenCentral()
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
runtimeOnly 'com.h2database:h2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
// Spring Boot
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
developmentOnly 'org.springframework.boot:spring-boot-devtools'

// thymeleaf
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.3.0'

// Kotlin
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'org.jetbrains.kotlin:kotlin-reflect'

// Database
runtimeOnly 'com.h2database:h2'

// Spring Test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

tasks.withType(KotlinCompile) {
kotlinOptions {
freeCompilerArgs += '-Xjsr305=strict'
jvmTarget = '17'
}
kotlinOptions {
freeCompilerArgs += '-Xjsr305=strict'
jvmTarget = '17'
}
}

tasks.named('test') {
useJUnitPlatform()
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ class UserEntity(
@GeneratedValue(strategy = GenerationType.IDENTITY)
var idx: Long = 0,

private var username : String,
private var password : String,
var nickname : String,
private var username: String,
private var password: String,
var nickname: String,

) : UserDetails {
override fun getAuthorities(): MutableCollection<out GrantedAuthority> {
return mutableListOf( GrantedAuthority { "ROLE_USER" } )
return mutableListOf(GrantedAuthority { "ROLE_USER" })
}

override fun getPassword(): String {
return password
}

fun setPassword(password: String) {
this.password = password
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package com.namju.simple_todo.user.service
import com.namju.simple_todo.user.dto.RegisterForm
import com.namju.simple_todo.user.entity.UserEntity
import com.namju.simple_todo.user.repository.UserRepository
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.security.core.userdetails.UserDetails
import org.springframework.security.core.userdetails.UserDetailsService
Expand All @@ -16,7 +17,7 @@ class UserService(
private val passwordEncoder: PasswordEncoder
) : UserDetailsService {

val log = LoggerFactory.getLogger(this::class.java)
val log: Logger = LoggerFactory.getLogger(this::class.java)

/**
* Spring Security 필수 메소드 구현
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ spring:


debug: true

server:
port: 80
Binary file added src/main/resources/static/favicon.ico
Binary file not shown.
22 changes: 16 additions & 6 deletions src/main/resources/templates/fragments/footer.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<footer th:fragment="fragment-footer" class="footer py-5 bg-light mt-auto">

<footer th:fragment="footerFragment" class="footer py-5 bg-light mt-auto">
<div class="container">
<div class="row">
<div class="col">
<p>&copy; Simple Todo Application by Kotlin</p>
<div class="col-md-6">
<p class="mb-0">&copy; 2024 Simple Todo Application by Kotlin</p>
</div>
<div class="col">
<p>개발자: Namju kim</p>
<p>연락처: <a href="mailto:cmsong111@gmail.com">cmsong111@gmail.com</a></p>
<div class="col-md-6">
<div class="row">
<div class="col-md-6">
<p class="mb-0">개발자: Namju Kim</p>
</div>
<div class="col-md-6">
<p class="mb-0">연락처: <a href="mailto:cmsong111@gmail.com">cmsong111@gmail.com</a></p>
</div>
</div>
</div>
</div>
<hr class="my-4"> <!-- 선택 사항: 시각적 구분선 추가 -->
<p class="small text-muted">이 웹 페이지는 개인 학습 및 연습 목적으로 작성되었습니다.<br>최신 정보는 확인해 주세요.</p>
</div>
</footer>

</html>
13 changes: 7 additions & 6 deletions src/main/resources/templates/fragments/header.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="fragment-header">
<meta charset="UTF-8">
<head th:fragment="headerFragment">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>투두 리스트</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.3/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
</head>
</html>

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<nav th:fragment="fragment-nav" class="navbar navbar-expand-lg bg-light">
<nav th:fragment="navBarFragment" class="navbar navbar-expand-lg bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Todo List</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown"
Expand Down
67 changes: 35 additions & 32 deletions src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<head>
<div th:replace="~{/fragments/header.html :: fragment-header}"></div>
</head>
<body>
<div class="container d-flex flex-column justify-content-center align-items-center min-vh-100 ">
<div class="row">
<div class="col-md-6">
<h1>Simple TODO</h1>
</div>
<div class="col-md-6">
<div class="row">
<div class="col">
<h2>로그인</h2>
<form method="post" action="/login_proc">
<div class="form-group">
<label for="username">이메일</label>
<input type="email" class="form-control" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">비밀번호</label>
<input type="password" class="form-control" id="password" name="password" required>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="layout/default_layout" lang="ko">

<th:block layout:fragment="content">
<div class="container-fluid">
<div class="row justify-content-center align-items-center" style="min-height: 60vh;">
<div class="col-md-6">
<div class="row ui-corner-left">
<div class="col-md-6">
<h1>Simple TODO</h1>
<p>간단한 할 일 목록을 만들어 보세요.</p>
</div>
<div class="col-md-6">
<div class="row">
<div class="col">
<h2>로그인</h2>
<form method="post" action="/login_proc">
<div class="form-group p-2">
<label for="username">이메일</label>
<input type="email" class="form-control" id="username" name="username" required>
</div>
<div class="form-group p-2" >
<label for="password">비밀번호</label>
<input type="password" class="form-control" id="password" name="password"
required>
</div>
<button type="submit" class="btn btn-primary">로그인</button>
<button type="button" class="btn btn-primary"
onclick="location.href='/register'">회원 가입</button>
</form>
</div>
</div>
<button type="submit" class="btn btn-primary" >로그인</button>
<button type="button" class="btn btn-primary" onclick="location.href='/register'">회원 가입</button>
</form>
</div>
<div class="col-md-12 text-center mt-4">
<hr style="border-top: 2px solid #ccc; width: 100%;">
</div>
</div>
</div>
</div>
</div>
</div>

<footer>
<div th:replace="~{/fragments/footer.html :: fragment-footer}"></div>
</footer>
</body>

</th:block>
</html>
9 changes: 9 additions & 0 deletions src/main/resources/templates/layout/default_layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<th:block th:replace="~{fragments/header :: headerFragment}"></th:block>
<body>
<th:block th:replace="~{fragments/nav-bar :: navBarFragment}"></th:block>
<th:block layout:fragment="content"></th:block>
</body>
<th:block th:replace="~{fragments/footer :: footerFragment}"></th:block>
</html>
Loading

0 comments on commit 4cffde5

Please sign in to comment.