우주먼지
article thumbnail
Published 2022. 11. 15. 09:51
Application Deployment & Build Framework/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=""

프로젝트 빌드
어플리케이션 실행


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

 

Test DB,User 생성

 

연동된 MySql testuser

 

테이블 생성

 

Post 요청

 

Member Table에 데이터 저장

'Framework > Spring' 카테고리의 다른 글

Spring Security 기본 구조  (0) 2022.11.18
Cookie & Session & 웹 보안 공격 & CA 발급/HTTPS 적용  (0) 2022.11.17
API Documentation (Spring RestDocs)  (0) 2022.11.12
Testing (Mockito)  (0) 2022.11.08
분산 트랜잭션  (0) 2022.11.08
profile

우주먼지

@o귤o

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!

검색 태그