diff --git a/build.gradle b/build.gradle index f0847c3..f28c929 100644 --- a/build.gradle +++ b/build.gradle @@ -35,6 +35,8 @@ bootJar { dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' + implementation 'org.springframework.boot:spring-boot-starter-jdbc' implementation 'org.springframework.boot:spring-boot-starter-data-redis' //implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-web' diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3bc9ad5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +version: '3' +services: + mysqldb: + container_name: mysqldb + platform: linux/amd64 + image: mysql:8.0.32 + restart: always + environment: + - MYSQL_DATABASE=ST_DASHBOARD + - MYSQL_ROOT_PASSWORD=1234 + - MYSQL_PASSWORD=1234 + healthcheck: + test: [ 'CMD-SHELL', 'mysqladmin ping -h 127.0.0.1 -u root --password=$$MYSQL_ROOT_PASSWORD' ] + interval: 10s + timeout: 2s + retries: 100 + ports: + - 3306:3306 + + backend: + build: . + restart: always + environment: + SPRING_DATASOURCE_DRIVER-CLASS-NAME: com.mysql.cj.jdbc.Driver + SPRING_DATASOURCE_URL: jdbc:mysql://mysqldb:3306/ST_DASHBOARD?allowPublicKeyRetrieval=true&useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul + SPRING_DATASOURCE_USERNAME: root + SPRING_DATASOURCE_PASSWORD: 1234 + ports: + - 8080:8080 + depends_on: + mysqldb: + condition: service_healthy \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index b50f96c..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,14 +0,0 @@ -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://mysql:3306/test_db?useSSL=false&serverTimezone=Asia/Seoul -spring.datasource.username=test -spring.datasource.password=test_pw - -spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.show-sql=true -spring.jpa.properties.hibernate.format_sql=true -spring.jpa.defer-datasource-initialization=true - -spring.sql.init.mode=always - -spring.profiles.include=API-KEY \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..05061dd --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,21 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/test_db?allowPublicKeyRetrieval=true&useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul + username: root + password: 1234 + thymeleaf: + cache: false + + # spring data jpa 설정 + jpa: + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + open-in-view: false + show-sql: true + hibernate: + ddl-auto: create + generate-ddl: true + +logging: + level: + sql: info \ No newline at end of file