Day95 실습프로젝트(Spring boot)
Spring Boot
- Spring Boot란?
1) build.gradel 적용하기
- plugins : 스프링 부트 및 의존성 버전 정보 주입
- configuration : 컴파일 옵션 설정
- implementation : 스플링 관련 라이브러리 추가
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.18'
id 'io.spring.dependency-management' version '1.1.6'
}
group = 'bitcamp'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
// implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.3.2'
// 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:2.3.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
// Tomcat Embedded Server용 JSP 엔진 라이브러리
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper:9.0.83'
// JSTL API 및 구현체 라이브러리
implementation 'javax.servlet:jstl:1.2'
// Amazon S3 라이브러리
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.772'
// implementation libs.guava
}
tasks.named('test') {
useJUnitPlatform()
}
2) config 파일 설정하기
RootConfig
: sql관련 설정하기- datasource 관련 객체 생성
- sqlFactory 관련 객체 생성
AppConfig
- viewResovler 관련 객체 생성
- multipart 관련 객체 생성
WebApplicationInitalizer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
spring.application.name=tripMaker
server.port=8888
server.servlet.context-path=/app
spring.datasource.url=jdbc:mysql://localhost/final_project
spring.datasource.username=root
spring.datasource.password=1111
mybatis.type-aliases-package=project.tripMaker.vo
mybatis.mapper-locations=/mappers/*Mapper.xml
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=50MB
spring.web.resources.static-locations=file:src/main/resources/static
3) dao 파일 바꾸기
이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.