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:
@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:
-
What is the reason for this problem and how can I fix it?
-
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.