스프링 부트 기본 세팅
의존성 주입
application.properties
#port 변경
server.port=8081
#thymleaf cashe false
spring.thymeleaf.cache=false
#데이터베이스 접속 정보
#spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:1521/xe
#spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.datasource.driver-class-name=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
spring.datasource.url=jdbc:log4jdbc:oracle:thin:@localhost:1521/xe
spring.datasource.username=MYDB
spring.datasource.password=ORACLE
#쿼리가 들어있는 mapper 파일 위치 지정
mybatis.mapper-locations=classpath:mappers/*.xml
mybatis.configuration.map-underscore-to-camel-case=true
spring.flyway.enabled=true
spring.flyway.locations=classpath:db/migration
#첨부파일
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB
#자동 런
spring.devtools.restart.enabled=true
spring.devtools.livereload.enabled=true
build.gradle
compileOnly("org.springframework.boot:spring-boot-devtools") //자동 Run 추가
implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4:1.16' //쿼리 로그 라이브러리 추가
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect' //fragment 사용을 위해 추가
mapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="">
<resultMap id="" type="">
<id column="" property=""/>
<result column="" property=""/>
</resultMap>
</mapper>
flagment - layout
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" >
<head>
<meta charset="UTF-8">
<title></title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<link rel="stylesheet" href="/css/common.css">
</head>
<body>
<div class="container">
<div class="row">
<!--고정 헤더 -->
<div class="col">
<th:block th:replace="~{fragment/main_header :: mainHeaderFragment}"></th:block>
</div>
</div>
<div class="row">
<!-- 컨텐츠 -->
<div class="col">
<th:block layout:fragment="content"></th:block>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
</body>
</html>
flagment - header
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<th:block th:fragment="mainHeaderFragment">
<div class="row">
<div class="col">
</div>
</div>
</th:block>
</body>
</html>