前提・実現したいこと
IntelliJを利用してSpringBootで開発中です。
MySQLに接続させたいのですが、エラーが出ます。
発生している問題・エラーメッセージ
ERROR 1468 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'inMemoryDatabaseShutdownExecutor' defined in class path resource [org/springframework/boot/devtools/autoconfigure/DevToolsDataSourceAutoConfiguration.class]: Unsatisfied dependency expressed through method 'inMemoryDatabaseShutdownExecutor' 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.jdbc.Driver (中略) Caused by: java.lang.IllegalStateException: Cannot load driver class: com.mysql.jdbc.Driver
該当のソースコード
どのコードを載せて良いのかわからなかったので、"build.gradle"と"application.properties"を記載します。
build.gradle(一部)
buildscript { ext { springBootVersion = '2.0.3.RELEASE' mySQLVersion= '5.7' } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } (中略) dependencies { compile('org.springframework.boot:spring-boot-starter-data-jpa') compile('org.springframework.boot:spring-boot-starter-thymeleaf') compile('org.springframework.boot:spring-boot-starter-web') compile("mysql:mysql-connector-java:$mySQLVersion") runtime('mysql:mysql-connector-java') testCompile('org.springframework.boot:spring-boot-starter-test') runtime('org.springframework.boot:spring-boot-devtools') }
application.properties
spring.datasource.url=jdbc:mysql://localhost/sample spring.datasource.username=root spring.datesource.password=****** spring.datasource.driver-class-name=com.mysql.jdbc.Driver soring.jpa.hidernate.ddl-auto=update spring.jpa.database=mySQL spring.jpa.show-sql=true
試したこと
ツールウィンドウのデータソース及びドライバの設定画面にて、各種設定は行いました。「接続のテスト」も成功しています。
MySQL ConnectorJの最新版はダウンロード済みです。
エラーメッセージをみて、"jdbcドライバ"に問題があることはわかったのですが、何をどうしたらいいのかわからない状態です。
補足情報(FW/ツールのバージョンなど)
開発環境
IntelliJ IDEA
Spring Boot[gradle]
MySQL@5.7
を利用しています。
初歩的な質問で申し訳ありませんが、よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー