투케이2K

96. (spring/스프링) [간단 소스] application.yml 파일에서 [mssql] [DB] 접속 정보 작성 본문

Spring

96. (spring/스프링) [간단 소스] application.yml 파일에서 [mssql] [DB] 접속 정보 작성

투케이2K 2022. 10. 4. 18:40

[개발 환경 설정]

개발 툴 : inteli j

개발 언어 : spring

 

[MSSQL 접속 정보]

 

[application.yml 접속 정보 작성]

spring:
  devtools:
    livereload:
      enabled: true
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://localhost:1433;serverName=DESKTOP-QDR03FS;encrypt=true;trustServerCertificate=true
    username: KGH_DB
    password: twok@2

server:
  port: 7000

mybatis:
  mapper-locations: classpath:D_Mybatis/*.xml
 

[build.gradle 소스 코드]

plugins {
	id 'org.springframework.boot' version '2.7.4'
	id 'io.spring.dependency-management' version '1.0.14.RELEASE'
	id 'java'
	id 'war'
}

group = 'com.kwon'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

//configurations {
//	compileOnly {
//		extendsFrom annotationProcessor
//	}
//}


// TODO [war 파일 빌드 명칭 변경]
war {
	archiveName 'mssql_test.war'
}


repositories {
	mavenCentral()
}

// TODO [war file create]
configurations {
	developmentOnly
	runtimeClasspath {
		extendsFrom developmentOnly
	}
	compileOnly {
		extendsFrom annotationProcessor
	}
}


dependencies {
	// TODO [spring jdbc and settings]
	implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
	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.2.2'
	compileOnly 'org.projectlombok:lombok'
	developmentOnly 'org.springframework.boot:spring-boot-devtools'

	// TODO [mssql database]
	runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc'

	// TODO [implement]
	annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
	annotationProcessor 'org.projectlombok:lombok'
	providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'

	// TODO [build gradle 설정]
	implementation 'org.json:json:20200518'

}

tasks.named('test') {
	useJUnitPlatform()
}

반응형
Comments