问题:
2018-10-10 16:51:12.420 ERROR 5332 --- [ main] com.zaxxer.hikari.HikariConfig : HikariPool-1 - jdbcUrl is required with driverClassName.
2018-10-10 16:51:12.423 WARN 5332 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBuilder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName.
2018-10-10 16:51:12.424 INFO 5332 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2018-10-10 16:51:12.430 INFO 5332 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-10-10 16:51:12.435 ERROR 5332 --- [ main] o.s.boot.SpringApplication : Application run failed
解决方法,将数据源配置文件
first.datasource.url=jdbc:MySQL://192.168.1.30:30006/nbsmt2?useUnicode=true&characterEncoding=utf-8
first.datasource.username=root
first.datasource.password=123456
first.datasource.driver-class-name=com.mysql.jdbc.Driver
first.datasource.type=mysqlsecond.datasource.url=jdbc:MySQL://192.168.1.32:3306/test?useUnicode=true&characterEncoding=utf-8
second.datasource.username=score
second.datasource.password=123456
second.datasource.driver-class-name=com.mysql.jdbc.Driver
second.datasource.type=mysql
改为
first.datasource.jdbc-url=jdbc:MySQL://192.168.1.30:30006/nbsmt2?useUnicode=true&characterEncoding=utf-8
first.datasource.username=root
first.datasource.password=123456
first.datasource.driver-class-name=com.mysql.jdbc.Driver
first.datasource.type=mysqlsecond.datasource.jdbc-url=jdbc:MySQL://192.168.1.32:3306/test?useUnicode=true&characterEncoding=utf-8
second.datasource.username=score
second.datasource.password=123456
second.datasource.driver-class-name=com.mysql.jdbc.Driver
second.datasource.type=mysql
原因分析(原因分析来自百度搜索得来):Hikari没有url属性,但是有一个jdbcUrl属性。