title: 'Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.' error in springboot application
body: <p>I created a springboot application that uses Spring Boot and Apache Camel JDBC Component for inserting a record in postgreSQL. For this purpose I am using the following dependencies:</p>
  <pre><code>    &lt;dependency&gt;
                  &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
                  &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
                  &lt;scope&gt;runtime&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
              &lt;/dependency&gt;
          &lt;dependency&gt;
          &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
          &lt;artifactId&gt;commons-dbcp2&lt;/artifactId&gt;
          &lt;version&gt;2.9.0&lt;/version&gt;
      &lt;/dependency&gt;
          &lt;dependency&gt;
          &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
          &lt;artifactId&gt;camel-jdbc&lt;/artifactId&gt;
          &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;!-- use the same version as your Camel core version --&gt;
      &lt;/dependency&gt;
  
  </code></pre>
  <p>As for the database configuration, I created the following java class with an application.properties file:</p>
  <p>Database Configuration java class:</p>
  <pre><code>
      import java.io.FileInputStream;
      import java.io.IOException;
      import java.util.Properties;
      import org.apache.camel.support.SimpleRegistry;
      import org.apache.commons.dbcp2.BasicDataSource;
      
      
      public class DatabaseConfiguration {
          public static SimpleRegistry createDatabaseConfiguration() throws IOException {
              Properties properties = new Properties();
              properties.load(new FileInputStream(&quot;src/main/resources/application.properties&quot;));
              BasicDataSource basic = new BasicDataSource();
              basic.setDriverClassName(properties.getProperty(&quot;PostgresDBClassname&quot;));
              basic.setUsername(properties.getProperty(&quot;PostgresDBUsername&quot;));
              basic.setPassword(properties.getProperty(&quot;PostgresDBPassword&quot;));
              basic.setUrl(properties.getProperty(&quot;PostgresDBUrl&quot;));
              SimpleRegistry registry = new SimpleRegistry();
              registry.bind(&quot;myDataSource&quot;, basic);
              return registry;
          }
      }
  
  </code></pre>
  <p>application.properties file:</p>
  <pre><code>PostgresDBUsername = username
  PostgresDBPassword = password
  PostgresDBClassname = org.postgresql.Driver
  PostgresDBUrl = jdbc:postgresql://localhost:5432/postgres
  </code></pre>
  <p>I wrote the router in the following way, noting that I tried to replace dataSource with myDataSource:</p>
  <pre><code>   @Component
  public class InsertRestService extends RouteBuilder {
  
    
  
      @Override
      public void configure() throws Exception {
          
  
          rest(&quot;/&quot;).produces(&quot;text/plain&quot;)
              .get(&quot;insert&quot;)
              .to(&quot;direct:hello&quot;);
  
          from(&quot;direct:hello&quot;)
              .transform().simple(&quot;INSERT INTO person (name, country) VALUES (DANY, LB)&quot;)
              .to(&quot;jdbc:dataSource&quot;) //spring boot starter jdbc creates the bean in the registry
              .transform().simple(&quot;Data inserted in Postgres successfully&quot;);
      }
  }
  
  
  </code></pre>
  <p>I got the following error:</p>
  <pre><code>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
  </code></pre>
  <p>I provided the URL in the application.properties file PostgresDBUrl</p>
  <p>Also note that I downloaded the jdbc driver jar file and added it to the module path, after a right click on the package, build path, configure build path
  <a href="https://i.stack.imgur.com/cGNVQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cGNVQ.png" alt="enter image description here" /></a>
  So what can I do to solve this issue?
  Thank you!!</p>