Datasource Autoconfiguration with spring.datasource properties breaks in 1.5.6.RELEASE whereas it works fine with 1.5.4.RELEASE version
See original GitHub issueUnable to create datasource in the recent spring boot 1.5.6.RELEASE using spring.datasource
properties whereas the same configuration works with 1.5.4.RELEASE.
Please find the configurations below:
application.yml
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/jpadb?autoReconnect=true&useSSL=false
username: root
password: root
jpa:
show-sql: true
hibernate:
ddl-auto: create-drop
pom.xml :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Error :
Description:
Parameter 0 of constructor in org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.
- Bean method 'dataSource' not loaded because @ConditionalOnProperty (spring.datasource.jndi-name) did not find property 'jndi-name'
- Bean method 'dataSource' not loaded because @ConditionalOnBean (types: org.springframework.boot.jta.XADataSourceWrapper; SearchStrategy: all) did not find any beans
Action:
Consider revisiting the conditions above or defining a bean of type 'javax.sql.DataSource' in your configuration.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Spring Boot Reference Guide
Spring Boot auto-configuration attempts to automatically configure your Spring application based on the jar dependencies that you have added. For example, If ...
Read more >Spring Boot + Spring data JPA + PostgreSQL - Mkyong.com
Puts a postgresql driver and defined the data source url in application.properties . Done, Spring Boot is able to connect to a PostgreSQL ......
Read more >Tutorial: Build Microservices Using Spring Boot an - DZone
This step-by-step guide helps full-stack developers build components in microservices using Spring Boot and employ them in Docker.
Read more >Spring Boot changelog - Awesome Java - LibHunt
We'd like to thank all the contributors who worked on this release! ... a configuration property for the driverClassName of the Liquibase DataSource...
Read more >chore(deps): update all dependencies (major) (!151 ... - GitLab
org.springframework.boot:spring-boot-starter-batch (source), 2.3.2.RELEASE -> 3.0.0 · age, adoption, passing, confidence.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It seems that the dependency for datasource, spring-boot-starter-jdbc is not included
In my way, there is two options to solve this issue :
Hope it useful ✌️