Reputation: 7516
I am trying to configure Spring boot and JPA in my application. After searching the Internet, I have configured my app like below (adding only relevant portion of code):
pom.xml:
<!-- JPA Starter -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${version.spring.boot}</version>
</dependency>
<!-- MySQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${version.mysql.driver}</version>
</dependency>
application.properties:
spring.datasource.url=jdbc:mysql://localhost/test
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
Application configuration Java class:
@StatelessBusinessService
@SpringBootApplication(
scanBasePackages = { "com.org.ist.module.service" }
)
@EnableScheduling
public class MyServiceApplication extends SpringBootServletInitializer {
public static void main(final String... args) {
final SpringApplication app = new SpringApplication(MyServiceApplication.class);
app.run(args);
}
@Override
protected SpringApplicationBuilder configure(final SpringApplicationBuilder builder) {
return builder.sources(MyServiceApplication.class);
}
And below is the error which I get when I execute mvn spring-boot:run
from terminal:
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
Action:
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 (no profiles are currently active).
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
Maybe I have missed some simple configuration?
Upvotes: 0
Views: 545
Reputation: 653
Please try adding the below annotation to spring boot application class to exclude auto configuration of data source.
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
Upvotes: 1