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.
Seen on:
Java
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 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026