Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Spring Boot found JDBC/JPA on the classpath but no database URL.
Failed to configure a DataSource'url' attribute is not specified Meaning
Adding spring-boot-starter-data-jpa triggers DataSource auto-configuration. Without spring.datasource.url (or an embedded DB like H2), startup fails. Profile-specific properties not loading is another cause.
Common causes
- spring.datasource.url missing
- Active profile not set, so application-prod.properties not loaded
- Environment variables not provided
- JPA added but no database intended
⚡ Quick fix
- Set spring.datasource.url/username/password
- Activate the right profile (SPRING_PROFILES_ACTIVE)
- Add H2 for local dev, or exclude DataSourceAutoConfiguration if no DB is needed
Detailed fix by platform
Java
spring.datasource.url=jdbc:postgresql://localhost:5432/app
How to diagnose
- Properties — Which file sets the URL?
- Profile — Which profile is active?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Java
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 14 Oct 2026