Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Spring Error: Failed to determine suitable jdbc url

I’m trying to learn Spring and following a guy’s instructions on YouTube. At first, he only initialized the Spring project and wrote configurations which I copied and created the database called employeemanager. In short, I did exactly the same things with him but I get this error when I try to run the program:

***************************
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 suitable jdbc URL

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).

I am using MySQL and JPA. This is my configuration:

spring.datasoruce.url=jdbc:mysql://localhost:3306/employeemanager
spring.datasource.username=root
spring.datasource.password=2525
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update

I found a solution online which is writing:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) instead of @SpringBootApplication

This solved the problem at first, however, some people mentioned that this is not a proper solution. So I have 2 questions:

  1. What is the reason for this problem and how can I fix it?

  2. What exactly the solution I mentioned is doing in simple words?

Thank you.

>Solution :

It seems you have misspelt the property spring.datasoruce.url incorrectly. The spelling of datasource is incorrect. Can you try with spring.datasource.url.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading