Build & Deploy & DB 연동

2023. 4. 3. 08:21·📘 Backend/Spring

📘Application Deployment & Build


IDE Tool이 없는 환경

  • Windows
    • PS C:/{direction}> .\gradlew bootjar
  • Git
    • Project Directory 이동
    • ./gradlew build
    • java -jar {project-name}.jar server-properties.active=""

프로젝트 빌드

img


어플리케이션 실행

img


Profile을 이용한 DB 설정 정보 포함

  • application-{name}.yml 형식의 환경 별 파일 생성 후 DB별로 설정 정보 분리

서버 배포

  • PaaS
    • CF CLI 사용 - cf push acloudyspringtime -p target/{file-name}.jar
  • IaaS
    • AWS Beanstalk, Container Registry, Code Deploy 등

IntelliJ <-> DB 연동

  • build.gradle
implementation 'mysql:mysql-connector-java'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
  • application.yml
# MySQL 설정
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

# DB Source URL
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/Schema?useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul

#DB Username
spring.datasource.username=<username>

#DB Password
spring.datasource.password=<password>

#true 설정시 JPA 쿼리문 확인 가능
spring.jpa.show-sql=true

#DDL(Create, Alter, Drop) 정의시 DB의 고유 기능을 사용할 수 있다.
spring.jpa.hibernate.ddl-auto=update

# JPA의 구현체인 Hibernate가 동작하면서 발생한 SQL의 가독성을 높여준다.
spring.jpa.properties.hibernate.format_sql=true

Test Connecttion Succeeded

img


Test DB,User 생성

img


연동된 MySql testuser

img


테이블 생성

img


Post 요청

img


Member Table에 데이터 저장

img

저작자표시 (새창열림)

'📘 Backend > Spring' 카테고리의 다른 글

Spring Security 구조  (0) 2023.04.04
HTTPS 적용  (0) 2023.04.03
Rest docs (API Documentation)  (0) 2023.04.03
Testing (Mockito) & Assertion  (0) 2023.04.03
Transaction & AOP 방식 / 분산 트랜잭션  (0) 2023.04.03
'📘 Backend/Spring' 카테고리의 다른 글
  • Spring Security 구조
  • HTTPS 적용
  • Rest docs (API Documentation)
  • Testing (Mockito) & Assertion
신건우
신건우
조용한 개발자
  • 신건우
    우주먼지
    신건우
  • 전체
    오늘
    어제
    • 분류 전체보기 (422)
      • 📘 Frontend (71)
        • Markup (1)
        • Style Sheet (2)
        • Dart (8)
        • Javascript (12)
        • TypeScript (1)
        • Vue (36)
        • React (2)
        • Flutter (9)
      • 📘 Backend (143)
        • Java (34)
        • Concurrency (19)
        • Reflection (1)
        • Kotlin (29)
        • Python (1)
        • Spring (42)
        • Spring Cloud (5)
        • Message Broker (5)
        • Streaming (2)
        • 기능 개발 (5)
      • 💻 Server (6)
        • Linux (6)
      • ❌ Error Handling (11)
      • 📦 Database (62)
        • SQL (31)
        • NoSQL (2)
        • JPQL (9)
        • QueryDSL (12)
        • Basic (4)
        • Firebase (4)
      • ⚙️ Ops (57)
        • CS (6)
        • AWS (9)
        • Docker (8)
        • Kubernetes (13)
        • MSA (1)
        • CI & CD (20)
      • 📚 Data Architect (48)
        • Data Structure (10)
        • Algorithm (8)
        • Programmers (17)
        • BaekJoon (5)
        • CodeUp (4)
        • Design Pattern (4)
        • AI (0)
      • ⚒️ Management & Tool (8)
        • Git (7)
        • IntelliJ (1)
      • 📄 Document (10)
        • Project 설계 (6)
        • Server Migration (3)
      • 📄 책읽기 (2)
        • 시작하세요! 도커 & 쿠버네티스 (2)
      • 🎮 Game (4)
        • Stardew Vally (1)
        • Path of Exile (3)
  • 블로그 메뉴

    • 링크

      • Github
    • 공지사항

    • 인기 글

    • 태그

      Lock #Thread #Concurrency
      React #Markdown
      GStreamer #Pipeline
    • 최근 댓글

    • 최근 글

    • hELLO· Designed By정상우.v4.10.0
    신건우
    Build & Deploy & DB 연동
    상단으로

    티스토리툴바