2016-05-17 4 views
0

は、私は、MySQLが私のMacBookにインストールされている次のエラーを取得しています:ここで春ブーツDatasourceBeanエラー私はTomcatを8に自分のアプリケーションを展開するときに、MacBookのは、MySQL

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate com.catalina.productcarried.dao.impl.ProductCarriedDAOImpl.jdbcTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
    ... 26 common frames omitted 

は私のapplication.propertiesファイルです。

#Database properties local 
spring.datasource.url=jdbc:mysql://localhost:3306/simulator?autoReconnect=true&useSSL=false  
spring.datasource.username=root 
spring.datasource.password=  
spring.datasource.driver-class-name=com.mysql.jdbc.Driver 
debug=true 
+1

であるあなたの依存関係

  • で定義されているあなたを貼り付けでしたポムのコンテンツ? – cpd214

  • +1

    'com.mysql.jdbc.Driver'はクラスパス上にありますか? – miensol

    答えて

    2

    データベース・タイプNONE用の組み込みデータベースドライバのクラスを決定することはできません。組み込みデータベースが必要な場合は、サポートされているデータベースをクラスパスに入れてください。特定のプロファイルからロードするデータベース設定がある場合は、アクティブにする必要があります(プロファイルは現在アクティブではありません)。

    application.propertiesは何らかの理由で考慮されていません。 driver-classは不要で、Springブートはurlパラメータからそれを検出します。

    次のことを確認するようにしてください:

    1. をMySQLドライバを使用すると、説明に提供application.propertiesファイルの内容がone of the supported locations
    関連する問題