title: The spring configuration client ignores active profile when sending request to configuration service
body: <p>I'm creating a configuration server using spring cloud and when I'm trying to get my configuration info from git using <code>http://localhost:8071/licensing-service/dev</code> it works perfectly.</p>
  <p>But when I specify the active profile <code>dev</code> in my configuration-client application
  it sends request on <code>http://localhost:8071/licensing-service/default</code> where as it should be sending request on <code>http://localhost:8071/licensing-service/dev</code>.</p>
  <p>Here is the debug info from configuration-client:</p>
  <pre><code>2022-08-03 01:44:11.999  INFO 11828 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8071
      2022-08-03 01:44:12.000 DEBUG 11828 --- [           main] o.s.web.client.RestTemplate              : HTTP GET http://localhost:8071/licensing-service/default
      2022-08-03 01:44:12.003 DEBUG 11828 --- [           main] o.s.web.client.RestTemplate              : Accept=[application/json, application/*+json]
      2022-08-03 01:44:12.677 DEBUG 11828 --- [           main] o.s.web.client.RestTemplate              : Response 200 OK
      2022-08-03 01:44:12.678 DEBUG 11828 --- [           main] o.s.web.client.RestTemplate              : Reading to [org.springframework.cloud.config.environment.Environment]
      2022-08-03 01:44:12.679  INFO 11828 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=licensing-service, profiles=[default], label=null, version=a846a28be97b432d11b0ec2a9476fa3c933ac5fc, state=null
      2022-08-03 01:44:12.680  INFO 11828 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-configClient'}, BootstrapPropertySource {name='bootstrapProperties-https://github.com/DaveySC/config.git/file:C:\Users\hrisa\AppData\Local\Temp\config-repo-12695370095836324476\licensing-service.yaml'}]
      2022-08-03 01:44:12.687  INFO 11828 --- [           main] c.e.l.LicensingServiceApplication        : The following 1 profile is active: &quot;dev&quot;
      2022-08-03 01:44:12.687 DEBUG 11828 --- [           main] o.s.boot.SpringApplication               : Loading source class com.example.licensingsevice.LicensingServiceApplication,class org.springframework.cloud.bootstrap.BootstrapApplicationListener$BootstrapMarkerConfiguration
      2022-08-03 01:44:12.708  INFO 11828 --- [           main] o.s.c.c.c.ConfigServerConfigDataLoader   : Fetching config from server at : http://localhost:8071
      2022-08-03 01:44:12.708  INFO 11828 --- [           main] o.s.c.c.c.ConfigServerConfigDataLoader   : Located environment: name=licensing-service, profiles=[dev], label=null, version=a846a28be97b432d11b0ec2a9476fa3c933ac5fc, state=null
      2022-08-03 01:44:12.709 DEBUG 11828 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@50d3bf39
      2022-08-03 01:44:13.482  INFO 11828 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
      2022-08-03 01:44:13.495 DEBUG 11828 --- [           main] o.s.b.a.AutoConfigurationPackages        : @EnableAutoConfiguration was declared on a class in the package 'com.example.licensingsevice'. Automatic @Repository and @Entity scanning is enabled.
      2022-08-03 01:44:13.538  INFO 11828 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 46 ms. Found 1 JPA repository interfaces.
      2022-08-03 01:44:13.750  INFO 11828 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=ed5de582-c803-356a-a378-fc5af6eb571e
      2022-08-03 01:44:14.113 DEBUG 11828 --- [           main] .s.b.w.e.t.TomcatServletWebServerFactory : Code archive: C:\Users\hrisa\.m2\repository\org\springframework\boot\spring-boot\2.7.2\spring-boot-2.7.2.jar
      2022-08-03 01:44:14.113 DEBUG 11828 --- [           main] .s.b.w.e.t.TomcatServletWebServerFactory : Code archive: C:\Users\hrisa\.m2\repository\org\springframework\boot\spring-boot\2.7.2\spring-boot-2.7.2.jar
      2022-08-03 01:44:14.113 DEBUG 11828 --- [           main] .s.b.w.e.t.TomcatServletWebServerFactory : None of the document roots [src/main/webapp, public, static] point to a directory and will be ignored.
      2022-08-03 01:44:14.133  INFO 11828 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
      2022-08-03 01:44:14.141  INFO 11828 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
      2022-08-03 01:44:14.142  INFO 11828 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.65]
      2022-08-03 01:44:14.295  INFO 11828 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
      2022-08-03 01:44:14.295 DEBUG 11828 --- [           main] w.s.c.ServletWebServerApplicationContext : Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
      2022-08-03 01:44:14.295  INFO 11828 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1586 ms
      2022-08-03 01:44:14.390 ERROR 11828 --- [           main] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'webMvcMetricsFilter' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webMvcMetricsFilter' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourcePoolMetadataMeterBinder' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/jdbc/DataSourcePoolMetricsAutoConfiguration$DataSourcePoolMetadataMetricsConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourcePoolMetadataMeterBinder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
      2022-08-03 01:44:14.410  INFO 11828 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
      2022-08-03 01:44:14.419  WARN 11828 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
      2022-08-03 01:44:14.443 DEBUG 11828 --- [           main] ConditionEvaluationReportLoggingListener : 
  </code></pre>
  <p>Here is the main class of this server, pom and bootstrap.yml</p>
  <pre><code>package com.example.configurationserver;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.cloud.config.server.EnableConfigServer;
  import org.springframework.cloud.context.config.annotation.RefreshScope;
  
  
      @SpringBootApplication
      @EnableConfigServer
      @RefreshScope
      public class ConfigurationServerApplication {
      
          public static void main(String[] args) {
              SpringApplication.run(ConfigurationServerApplication.class, args);
          }
      
      }
  </code></pre>
  <p>pom.xml</p>
  <pre><code>   &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.7.2&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;com.example&lt;/groupId&gt;
      &lt;artifactId&gt;configuration-server&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;configuration-server&lt;/name&gt;
      &lt;description&gt;configuration-server&lt;/description&gt;
      &lt;properties&gt;
          &lt;java.version&gt;17&lt;/java.version&gt;
          &lt;spring-cloud.version&gt;2021.0.3&lt;/spring-cloud.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-config-server&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-starter-bootstrap&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;de.codecentric&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-admin-starter-client&lt;/artifactId&gt;
              &lt;version&gt;2.7.1&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;
                  &lt;version&gt;${spring-cloud.version}&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  <p>bootstrap.yml</p>
  <pre><code>spring:
    application:
      name: configuration-server
    profiles:
      active: git
    cloud:
      config:
        server:
          git:
            default-label: main
            uri: https://github.com/DaveySC/config.git
    boot:
      admin:
        client:
          url: http://localhost:8080
  
  server:
    port: 8071
  
  management:
    endpoints:
      web:
        exposure:
          include: &quot;*&quot;
  </code></pre>
  <p>Here are the client files: <br>
  pom.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.7.2&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;com.example&lt;/groupId&gt;
      &lt;artifactId&gt;licensing-service&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;licensing-service&lt;/name&gt;
      &lt;description&gt;licensing-sevice&lt;/description&gt;
      &lt;properties&gt;
          &lt;java.version&gt;17&lt;/java.version&gt;
          &lt;spring-cloud.version&gt;2021.0.3&lt;/spring-cloud.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-hateoas&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-starter-config&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
              &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-configuration-processor&lt;/artifactId&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-starter-bootstrap&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;
                  &lt;version&gt;${spring-cloud.version}&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  <p>bootstrap.yml</p>
  <pre><code>spring:
    application:
      name: licensing-service
    config:
      import: optional:configserver:http://localhost:8071
    profiles:
      active: dev
  debug: true
  </code></pre>
  <p>And here is the exception i get:</p>
  <pre><code>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 (the profiles dev are currently active).
  </code></pre>
  <p>What should i do to make my app send request on the url that depends on the active profile client app?</p>