그냥 이런거 저런거 겪어본 현상이나 학습한 내용 작성하는 공간
gradle 노트
dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	compileOnly 'org.projectlombok:lombok'
	developmentOnly 'org.springframework.boot:spring-boot-devtools'
	annotationProcessor 'org.projectlombok:lombok'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
	runtimeOnly 'com.mysql:mysql-connector-j'
	// Thymeleaf Layout Dialect 추가 (레이아웃 템플릿 기능)
	implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'
}
properties(프로퍼티스) / YML 노트
# Spring 애플리케이션 이름 설정
spring.application.name=demo
# 서버 포트 설정
server.port=8080
# 데이터베이스 연결 설정 (MySQL)
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/notice
spring.datasource.username=root
spring.datasource.password=0000
# JPA 설정
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=true
HTML / 타임리프 노트
- 헤더나 푸터는 없어도 동작 했지만 공통 layout을 다른 html에서 사용할 때 문제가 있었다.
 
- 때문에 해당 그래들을 추가 함
 
- 아래의 그래들 설정이 없으면 타임리프에서 fragment가 동작하지 않음.
 
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title th:text="${pageTitle}">나의 애플리케이션</title>
    
    <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/daisyui@1.14.3"></script>
</head>
<body class="bg-base-200">
<div class="flex flex-col md:flex-row h-screen">
    
    <div th:replace="common/navbar :: navbar"></div>
    
    <div class="flex-1 flex flex-col">
        
        <div th:replace="common/header :: header"></div>
        
        <main class="flex-1 p-6">
            
            <div layout:fragment="content"></div>
        </main>
        
        <div th:replace="common/footer :: footer"></div>
    </div>
</div>
</body>
</html>
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org" layout:decorate="common/layout">
<head>
    <title>Main Page</title>
</head>
<body>
<div layout:fragment="content">
    
    <div class="card bg-base-100 shadow-xl p-4">
        <h2 class="text-2xl font-bold mb-4">메인 페이지 콘텐츠</h2>
        <p class="mb-4">이곳은 메인 페이지의 고유한 내용입니다.</p>
        <button class="btn btn-primary">메인 페이지 작업 실행</button>
    </div>
</div>
</body>
</html>
DB 노트
자바 노트