Spring Boot jdbc issue. Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured

drewlakee :

I'm just connected this DB in Intellij IDEA and it's fine, but when I launch my Spring Boot App with this configs, I see this trouble's messages

***Configs on pics

2019-05-28 20:56:53.487 ERROR 700 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
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 a suitable driver class


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


Process finished with exit code 0

application.properties pom

Shashank Gupta :

We need to add a bean for DataSource in the configuration class, something like this

@Bean
public DataSource dataSource(){
    DriverManagerDataSource source = new DriverManagerDataSource();
    source.setDriverClassName(driverClass);
    source.setUrl(url);
    source.setUsername(username);
    source.setPassword(password);
    return source;
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Spring Boot: Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. SPRING

Spring Framework: Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured

Config-Server Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured

Gradle project --Failed to configure a DataSource'url' attribute is not specified and no embedded datasource could be configured

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.Error In Gradle project

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. Reason: Fa

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured for MongoDb

SpringBoot2 Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured

'url' attribute is not specified and no embedded datasource could be configured

Failed to configure a DataSource: 'url' attribute is not specified using Spring Boot

'url' attribute is not specified and no embedded datasource could be configured. Failed to determine a suitable driver class

Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified

Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified

Failed to configure a DataSource: 'url'

Failed to auto-configure a DataSource: 'spring.datasource.url'

Properties in my application.properties file are greyed out, i get Failed to configure a DataSource: 'url' attribute is not specified

Configure DataSource programmatically in Spring Boot

configure dataSource for liquibase in spring boot

spring boot autoconfiguration with jdbc template autowiring dataSource issue

Spring Boot Unable to determine jdbc url from datasource

Springboot + JSP + Spring Security: Failed to configure a DataSource

Configure Multiple DataSource in Spring Boot with JNDI

Spring boot: configure hsqldb datasource to persist data

How to configure DataSource for a Spring-Boot Application in a Standalone (war) and in an embedded Tomcat?

Spring Boot @Transactional Attribute with Multiple DataSource

Failed to configure a DataSource in Spring Boot with H2 in-memory database

Spring Boot: Datasource properties