本文主要是介绍[spring error] Failed to bind properties under 'spring.datasource' to javax.sql.DataSource:,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
使用spring 连接数据库时,在升级spring boot版本之后,启动项目报错如下:
Failed to bind properties under 'spring.datasource' to javax.sql.DataSource:Property: spring.datasource.driverclassnameValue: org.postgresql.Driver Origin: class path resource [application-postgres.properties]:7:35Reason: Failed to load driver class org.postgresql.Driver in either of HikariConfig class loader or Thread context classloader
在property文件里面对数据库的定义如下:
spring.datasource.url=jdbc:postgresql://localhost:5432/test
spring.datasource.username=user
spring.datasource.password=ped
spring.datasource.driverClassName=org.postgresql.Driver
数据库DataSource bean的定义如下:
@Configuration
@Profile("postgres")
public class SourceDataSourceConfigurationLocal {@Bean@C
这篇关于[spring error] Failed to bind properties under 'spring.datasource' to javax.sql.DataSource:的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!