위로
아래
build.gradle
<!-- build.gradle -->
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.4'
id 'io.spring.dependency-management' version '1.1.3'
}
group = 'com.shop.demo'
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '17'
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation group: 'org.glassfish.web', name: 'jakarta.servlet.jsp.jstl', version: '2.0.0'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-web-services'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.2'
implementation 'org.springframework.session:spring-session-core'
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper:10.1.9'
compileOnly 'javax.servlet.jsp:jsp-api:2.0'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:3.0.2'
testImplementation 'ch.qos.logback:logback-classic:0.9.26'
}
tasks.named('test') {
useJUnitPlatform()
}
application.properties
<!-- application.properties -->
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/board
spring.datasource.username=root
spring.datasource.password=70657065
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=true
server.port=9003
spring.main.banner-mode=off
server.servlet.session.timeout=30m
logging.level.jdbc.sqlonly=DEBUG
logging.level.org.springframework.web=DEBUG
logging.level.com.zaxxer.hikari.HikariDataSource: ERROR
# mapper 로그레벨 설정
logging.level.com.azurealstn.codespringweb.mapper=TRACE
#전체 로그 레벨 설정(기본 info)
logging.level.root=info
spring.mvc.view.prefix=/WEB-INF/views/
spring.mvc.view.suffix=.jsp
server.servlet.jsp.init-parameters.development=true
#mybatis.type-aliases-package=com.ecom4.custom.model,com.ecom4.product.model
mybatis.config-location=classpath:/mybatisConfig/Mybatis-Config.xml
mybatis.mapper-locations=classpath:**/mapper/*Mapper.xml
logging.level.net.chndol.stydy.maybatisssampl.mapper=INFO
Mybatis
<!-- Mybatis-Config.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "HTTP://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="cacheEnabled" value="false" />
<setting name="useGeneratedKeys" value="true" />
<setting name="defaultExecutorType" value="REUSE" />
<setting name="jdbcTypeForNull" value="NULL" />
</settings>
<!-- aliaes - short name setting bvo, pvo-->
<typeAliases>
<typeAlias alias="hashMap" type="java.util.HashMap" />
<typeAlias alias="map" type="java.util.Map" />
</typeAliases>
</configuration>
logback.xml
<!-- logback.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="30 seconds">
<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>Users\_o_h_y_o_\Documents\coding\boardLog.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>Users\_o_h_y_o_\Documents\coding\boardLog-%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss.SSS} [%-5level] - %msg%n</Pattern>
</layout>
</appender>
<!-- Loggers -->
<!-- <logger name="org.apache.catalina" level="ERROR">
</logger>
<logger name="org.apache.commons" level="ERROR">
</logger> -->
<!-- <logger name="org.springframework" level="DEBUG" >
</logger> -->
<!-- <logger name="java.sql" level="DEBUG">
</logger> -->
<logger name="org.mybatis.spring" level="DEBUG">
</logger>
<root level="DEBUG">
<appender-ref ref="ROLLING"/>
<appender-ref ref="STDOUT" />
</root>
</configuration>