Reputation: 9028
I am trying to use spring boot(1.4.3.RELEASE) autoconfoguration. This is a multi module project.
parent project
|---pom.xml -> This is a parent pom.
|---repository(Spring Data)
|---pom.xml
|---src
|---web
|---pom.xml
|---src
My application.properties,
# Dialer Data Access
spring.datasource.hikari.connection-test-query=SELECT 1 FROM DUAL
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=10
spring.datasource.hikari.pool-name=cc_dialer
spring.datasource.hikari.driver-class-name=com.mariadb.jdbc.Driver
spring.datasource.hikari.url=jdbc:mysql://localhost:3306/dialer
spring.datasource.hikari.username=root
spring.datasource.hikari.password=root
spring.datasource.hikari.type com.zaxxer.hikari.HikariDataSource
web module Application.java,
@SpringBootApplication(exclude = { VelocityAutoConfiguration.class }, scanBasePackages =
{ "com.test.dbrepo.repository" })
@EnableScheduling
public class DialerApplication {
Web pom.xml,
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
Repository application,
@SpringBootApplication(scanBasePackages = { "com.cc.dialer.dbrepo" })
public class DialerDBServiceApplication {
Repository pom.xml,
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.zaxxer/HikariCP -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<!-- <version>2.5.1</version>-->
</dependency>
<!-- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<!-- <version>1.5.7</version>-->
</dependency>
I am trying to use Spring boot autoconfiguration, but getting the below error.
2017-01-17 14:57:59.903 [main] WARN o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': 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$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (the profiles "dev" are currently active).
2017-01-17 14:57:59.905 [main] INFO o.a.catalina.core.StandardService - Stopping service Tomcat
2017-01-17 14:57:59.911 [main] WARN o.s.boot.SpringApplication - Error handling failed (Error creating bean with name 'delegatingApplicationListener' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available)
2017-01-17 14:57:59.914 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter -
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
Upvotes: 2
Views: 5106
Reputation: 666
You can use something like below in your property file configuration.
spring.datasource.url=jdbc:mysql://localhost/test
spring.datasource.username=<user>
spring.datasource.password=<password>
spring.datasource.driver-class-name=<driver classname>
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.maximum-pool-size=50
spring.datasource.hikari.idle-timeout=1000
spring.datasource.hikari.pool-name=blah
Upvotes: 1