[Spring] AWS RDS - Spring boot ( MariaDB ) 프로젝트 연결 (2)

2024. 6. 2. 02:23·Spring

* 스프링 부트 (Spring Boot)

 - build.gradle : mariadb 의존성 추가

dependencies {

	runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'

}

 - application.properties : 데이터베이스(mariaDB) 연결정보와 관련 설정 

# AWS 연동
# JDBC 드라이버 클래스 이름
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
# 데이터베이스 URL
spring.datasource.url=jdbc:mariadb://엔드포인트/데이터베이스_이름
# 데이터베이스 사용자 이름
spring.datasource.username=root
# 데이터베이스 비밀번호
spring.datasource.password=비밀번호

#로컬서버
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
# 데이터베이스 URL
spring.datasource.url=jdbc:mariadb://localhost:3306/데이터베이스_이름
# 데이터베이스 사용자 이름
spring.datasource.username=root
# 데이터베이스 비밀번호
spring.datasource.password=비밀번호

 - Git 저장소에 올릴 때 ( 보안 )

  • application-aws.properties
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mariadb://엔드포인트/데이터베이스_이름
spring.datasource.username=root
spring.datasource.password=비밀번호
  • application.properties
# application.properties
spring.profiles.include=aws
  • .gitignore
### AWS ###
application-aws.properties
 

'Spring' 카테고리의 다른 글

[Spring] Spring Security OAuth2 - 인증 및 인가 흐름 요약  (0) 2024.07.21
[Spring] warning: Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object. If this is intentional, add '@EqualsAndHashCode(callSuper=false)' to your type.  (0) 2024.06.10
'Spring' 카테고리의 다른 글
  • [Spring] Spring Security OAuth2 - 인증 및 인가 흐름 요약
  • [Spring] warning: Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object. If this is intentional, add '@EqualsAndHashCode(callSuper=false)' to your type.
밀27
밀27
  • 밀27
    밀2
    밀27
    • 분류 전체보기 (33)
      • Git (1)
      • AWS (1)
      • Flutter (3)
      • Spring (3)
      • MariaDB (2)
      • TIL (23)
  • 블로그 메뉴

    • 홈
    • 태그
  • 최근 글

  • hELLO· Designed By정상우.v4.10.0
밀27
[Spring] AWS RDS - Spring boot ( MariaDB ) 프로젝트 연결 (2)
상단으로

티스토리툴바