teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

applications.propertiesの内容を追加しました。

2020/04/17 16:15

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -70,8 +70,21 @@
70
70
  useJUnitPlatform()
71
71
  }
72
72
  ```
73
+ - application.properties
74
+ ```ここに言語を入力
73
75
 
76
+ #データベース
77
+ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
78
+ spring.datasource.url=jdbc:mysql://localhost:3306/myapp_db
79
+ spring.datasource.username=root
80
+ spring.datasource.password=root
81
+ spring.datasource.sql-script-encoding=utf-8
82
+ spring.jpa.database=MYSQL
74
83
 
84
+ #サーバー
85
+ ```
86
+
87
+
75
88
  ### 試したこと
76
89
  0. mysql-connector-java-8.0.19.jarが依存関係にダウンロードされたいなかったので、自らダウンロードして直接jarを指定してみたがエラー内容は変わらずでした。
77
90
  0. javaのビルドバージョンを変更してみたが変わらずでした。

1

build.gradleの内容を追加しました

2020/04/17 16:15

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -40,9 +40,38 @@
40
40
  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.mysql.cj.jdbc.Driver
41
41
  ※続きあり
42
42
  ```
43
+ - build.gradle
44
+ ```ここに言語を入力
45
+ plugins {
46
+ id 'org.springframework.boot' version '2.2.6.RELEASE'
47
+ id 'io.spring.dependency-management' version '1.0.9.RELEASE'
48
+ id 'java'
49
+ }
43
50
 
51
+ group = 'com.kametalk.app'
52
+ version = '0.0.1-SNAPSHOT'
53
+ sourceCompatibility = '${java_version}'
44
54
 
55
+ repositories {
56
+ mavenCentral()
57
+ }
45
58
 
59
+ dependencies {
60
+ implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
61
+ runtimeOnly group: 'mysql', name: 'mysql-connector-java', version: '${mysql_version}'
62
+ implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
63
+ implementation 'org.springframework.boot:spring-boot-starter-web'
64
+ testImplementation('org.springframework.boot:spring-boot-starter-test') {
65
+ exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
66
+ }
67
+ }
68
+
69
+ test {
70
+ useJUnitPlatform()
71
+ }
72
+ ```
73
+
74
+
46
75
  ### 試したこと
47
76
  0. mysql-connector-java-8.0.19.jarが依存関係にダウンロードされたいなかったので、自らダウンロードして直接jarを指定してみたがエラー内容は変わらずでした。
48
77
  0. javaのビルドバージョンを変更してみたが変わらずでした。