I have an application.yml(!) for the configuration containing the following:
JavaScript
x
spring:
datasource:
url: "jdbc:h2:file:./camunda-h2-database"
driverClassName: "org.h2.Driver"
username: "sa"
password: ""
Which gives me the errormessage:
JavaScript
2021-03-11T17:02:48,600 WARN [main] o.s.c.s.AbstractApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.camunda.bpm.spring.boot.starter.CamundaBpmAutoConfiguration$ProcessEngineConfigurationImplDependingConfiguration': Unsatisfied dependency expressed through field 'processEngineConfigurationImpl'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'processEngineConfigurationImpl' defined in class path resource [org/camunda/bpm/spring/boot/starter/CamundaBpmConfiguration.class]: Unsatisfied dependency expressed through method 'processEngineConfigurationImpl' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'camundaDatasourceConfiguration': Unsatisfied dependency expressed through field 'dataSource'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.sql.DataSource' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Doing it this way works:
JavaScript
public DriverManagerDataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("org.h2.Driver");
dataSource.setUrl("jdbc:h2:file:./camunda-h2-database");
dataSource.setUsername("sa");
dataSource.setPassword("");
return dataSource;
}
@Bean
public PlatformTransactionManager transactionManager() {
return new DataSourceTransactionManager(dataSource());
}
Ideas? 🙂
Advertisement
Answer
Rename driverClassName
to driver-class-name
since Kebab case is preferred over Camel case in Spring Boot Auto Configuration properties.
If that doesn’t help then make sure that you didn’t turn off DataSourceAutoConfiguration
feature. It usually may look like
JavaScript
@SpringBootApplication(exclude = [DataSourceAutoConfiguration::class])
public class BootApplication { }