GithubHelp home page GithubHelp logo

springboot-restapi-boilerplate's Introduction

springboot-restapi-boilerplate

매번 spring boot 프로젝트를 초기화하기 번거로워서 본 프로젝트를 만듦

사용방법

단, mysql 데이터베이스 서버가 가동중이어야 함

Build

$ ./gradlew build

Test

$ ./gradlew test

Run (with gradle spring boot plugin)

$ ./gradlew bootRun

Run (with JAR)

$ java -jar ./build/libs/*.jar

Auto reload run

코드 수정할 때 마다 서버가 자동으로 재시작하게 하려면 다음 두 커맨드를 입력하면 된다.

  • 자동 빌드
$ ./gradlew build --continuous -xtest
$ ./gradlew bootRun

데이터베이스 접속 정보

본 boilerplate 는 mysql 데이터베이스를 사용하고 있으며 다른 데이터베이스로 교체시 적절한 dependency 를 추가해줘야 함
application-dev.properties 를 수정하여 데이터베이스에 접속해야 함

# JDBC 접속 설정
spring.jpa.hibernate.ddl-auto=update

# jdbc:mysql://{{데이터베이스주소}}/{{데이터베이스스키마}}?{{타임존}}
spring.datasource.url=jdbc:mysql://localhost:3306/springboot_development?serverTimezone=UTC&characterEncoding=UTF-8

# 접속할 계정 정보
spring.datasource.username=root
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
spring.jpa.show-sql=true

로깅 설정

logback-spring.xml 을 수정하여
파일 로깅 / 콘솔 로깅 전환 가능 (기본값은 콘솔 로깅)

API documentation

Restdocs 라이브러리를 활용하여 API 문서를 자동화함.

  1. 서버 실행
  2. {ServerDomain}/docs/api-guide.html 접속

참조: Admin dashboard

다음 링크 를 참조하면 spring boot 서버를 모니터링 할 수 있는 spring boot admin server 를 세팅할 수 있다.

springboot-restapi-boilerplate's People

Contributors

omnipede avatar

Stargazers

도준회 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.