I have below application.properties in my application for configuring two datasources and my Spring boot version is 2.1.3.RELEASE
spring.datasource2.url=jdbc:postgresql://localhost:5432/db1
spring.datasource2.username=//username
spring.datasource2.password=//pwd
spring.datasource1.url=jdbc:postgresql://localhost:5432/db2
spring.datasource1.username=//username
spring.datasource1.password=//pwd
spring.datasource1.initialization-mode=always
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.id.new_generator_mappings=false
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
spring.h2.console.enabled=true
I get the following error
ContextLoader:296 - Root WebApplicationContext: initialization completed in 3970 ms
[main] WARN AnnotationConfigServletWebServerApplicationContext:557 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor 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 org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2020-12-04 20:47:27 [main] INFO StandardService:173 - Stopping service [Tomcat]
2020-12-04 20:47:27 [main] INFO ConditionEvaluationReportLoggingListener:142 -
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-12-04 20:47:27 [main] ERROR LoggingFailureAnalysisReporter:42 -
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
What I tried so far:
Disabling DatasourceAutoConfiguration.class, HibernateJPAAutoCOnfiguration.class, TransactionManagerAutoConfiguration.class
It did not work.
How do I resolve this?
Thank you in advance!