使用spring 连接数据库时,在升级spring boot版本之后,启动项目报错如下:
Failed to bind properties under 'spring.datasource' to javax.sql.DataSource:
Property: spring.datasource.driverclassname
Value: org.postgresql.Driver
Origin: class path resource [application-postgres.properties]:7:35
Reason: 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