spring-cloud / spring-cloud-config

External configuration (server and client) for Spring Cloud
Apache License 2.0
1.96k stars 1.29k forks source link

Issue with Spring Config server in embedded mode #2366

Closed rohitdev closed 10 months ago

rohitdev commented 11 months ago

Describe the bug Framework details spring-cloud.version : 2023.0.0-RC1 spring-boot-starter-parent : 3.2.0 JDK 21 (Zulu JDK)

I was trying out a PoC to create an embedded config server within a Spring boot app.I am using JDBC as a backend.Used the spring initialiser to create the project in the Intellij IDE. The application is not working and not able to replace the placeholders.

Followed the documentation here: https://docs.spring.io/spring-cloud-config/reference/server/embedding.html & here https://docs.spring.io/spring-cloud-config/reference/server/environment-repository/composite-repositories.html

Created bootstrap & application yaml

Bootstrap.yaml

spring:
  application:
    name: admin-service
  datasource:
    password: {db password}
    driver-class-name: org.postgresql.Driver
    username: {db username}
    url: jdbc:postgresql://127.0.0.1:5432/{instanceid}
  jpa:
    show-sql: 'true'
  cloud:
    config:
      label: master
      profile: composite
      server:
        bootstrap: true
        composite:
          - type: jdbc
            order: 1
            sql: SELECT PROP_KEY, PROP_VALUE from tmx_admin.PROPERTIES where APPLICATION=? and PROFILE=? and LABEL_VALUE=?
  server:
    port: '8888'

application.yaml

spring:
  application:
    name: admin-service
  profiles:
    active: dev,jdbc
logging:
  level:
    org:
      springframework:
        context: DEBUG
        web: DEBUG
        boot: TRACE
        cloud:
          config: TRACE

Added @EnableConfigServer my spring application launcher class In the configuration bean I am now trying to inject values in the place holders

@Value("${app.cache.redis.host}")

Below is the stacktrace i keep getting and the applicatrion fails


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appConfig': Injection of autowired dependencies failed
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:499) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:946) ~[spring-context-6.1.1.jar:6.1.1]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616) ~[spring-context-6.1.1.jar:6.1.1]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:323) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331) ~[spring-boot-3.2.0.jar:3.2.0]
    at com.example.csdbdemo.CsdbdemoApplication.main(CsdbdemoApplication.java:17) ~[classes/:na]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.2.0.jar:3.2.0]
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'app.cache.redis.host' in value "${app.cache.redis.host}"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:180) ~[spring-core-6.1.1.jar:6.1.1]
    at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) ~[spring-core-6.1.1.jar:6.1.1]
    at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239) ~[spring-core-6.1.1.jar:6.1.1]
    at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-6.1.1.jar:6.1.1]
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:200) ~[spring-context-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:921) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1372) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1348) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:769) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:752) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:145) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:493) ~[spring-beans-6.1.1.jar:6.1.1]
    ... 20 common frames omitted
rohitdev commented 11 months ago

I looked at the issue mentioned here , took the project mentioned here and deployed it under JDK 21 (default is configured with JDK8 and it ran fine) it failed, bumped it down to JDK 17 it worked. I than took similar configurations its not working for me with JDK 17 or JDK 11. I am getting this stacktrace

`Caused by: java.lang.NullPointerException: Cannot invoke "Object.hashCode()" because "key" is null
    at java.base/java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936) ~[na:na]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:888) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.cloud.config.server.composite.CompositeUtils.getEnvironmentRepositoryFactoryTypeParams(CompositeUtils.java:79) ~[spring-cloud-config-server-4.1.0-RC1.jar:4.1.0-RC1]
    at org.springframework.cloud.config.server.composite.OnSearchPathLocatorPresent.getMatchOutcome(OnSearchPathLocatorPresent.java:46) ~[spring-cloud-config-server-4.1.0-RC1.jar:4.1.0-RC1]
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-3.2.0.jar:3.2.0]
    ... 36 common frames omitted`
rohitdev commented 11 months ago

New application.yml

spring:
  application:
    name: admin-service
  profiles:
    active: devil

New bootstrap

spring:
  application:
    name: admin-service
  profiles:
    active: composite
  datasource:
    password: password
    driver-class-name: 'org.postgresql.Driver'
    username: rohitdev
    url: 'jdbc:postgresql://127.0.0.1:5432/harmony'
  jpa:
    show-sql: 'true'
  cloud:
    config:
      label: master
      enabled: true
      prefix: /config
      server:
        bootstrap: true
        composite:
          - type: jdbc
            order: 1
            sql: 'SELECT PROP_KEY, PROP_VALUE from tmx_admin.PROPERTIES where APPLICATION=? and PROFILE=? and LABEL_VALUE=?'
  server:
    port: 8888

Getting the below stacktrace

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.example.csdbdemo.config.AppConfig': Injection of autowired dependencies failed
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:499) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:946) ~[spring-context-6.1.1.jar:6.1.1]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616) ~[spring-context-6.1.1.jar:6.1.1]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:323) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:149) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:195) ~[spring-cloud-context-4.1.0.jar:4.1.0]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:114) ~[spring-cloud-context-4.1.0.jar:4.1.0]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:77) ~[spring-cloud-context-4.1.0.jar:4.1.0]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:178) ~[spring-context-6.1.1.jar:6.1.1]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:171) ~[spring-context-6.1.1.jar:6.1.1]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:149) ~[spring-context-6.1.1.jar:6.1.1]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:137) ~[spring-context-6.1.1.jar:6.1.1]
    at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:81) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:64) ~[spring-boot-3.2.0.jar:3.2.0]
    at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
    at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:63) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:366) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:318) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331) ~[spring-boot-3.2.0.jar:3.2.0]
    at com.example.csdbdemo.CsdbdemoApplication.main(CsdbdemoApplication.java:21) ~[classes/:na]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.2.0.jar:3.2.0]
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'app.datasource.jdbc.className' in value "${app.datasource.jdbc.className}"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:180) ~[spring-core-6.1.1.jar:6.1.1]
    at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) ~[spring-core-6.1.1.jar:6.1.1]
    at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239) ~[spring-core-6.1.1.jar:6.1.1]
    at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-6.1.1.jar:6.1.1]
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:200) ~[spring-context-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:921) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1372) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1348) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:769) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:752) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:145) ~[spring-beans-6.1.1.jar:6.1.1]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:493) ~[spring-beans-6.1.1.jar:6.1.1]
rohitdev commented 11 months ago

============================
CONDITIONS EVALUATION REPORT
============================

Positive matches:
-----------------

   CompositeRepositoryConfiguration#compositeEnvironmentRepository matched:
      - matched (OnSearchPathLocatorPresent)

   ConfigServerBootstrapConfiguration matched:
      - @ConditionalOnProperty (spring.cloud.config.server.bootstrap) matched (OnPropertyCondition)

   ConfigServiceBootstrapConfiguration#configClientProperties matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.config.client.ConfigClientProperties; SearchStrategy: all) did not find any beans (OnBeanCondition)

   ConfigurationPropertiesRebinderAutoConfiguration matched:
      - @ConditionalOnBean (types: org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor; SearchStrategy: all) found bean 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' (OnBeanCondition)

   ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesBeans matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesBeans; SearchStrategy: current) did not find any beans (OnBeanCondition)

   ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesRebinder matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder; SearchStrategy: current) did not find any beans (OnBeanCondition)

   DefaultTextEncryptionAutoConfiguration#defaultTextEncryptor matched:
      - @ConditionalOnMissingBean (types: org.springframework.security.crypto.encrypt.TextEncryptor; SearchStrategy: all) did not find any beans (OnBeanCondition)

   DefaultTextEncryptionAutoConfiguration#keyProperties matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.bootstrap.encrypt.KeyProperties; SearchStrategy: all) did not find any beans (OnBeanCondition)

   EncryptionAutoConfiguration#environmentEncryptor matched:
      - @ConditionalOnProperty (spring.cloud.config.server.encrypt.enabled) matched (OnPropertyCondition)
      - @ConditionalOnBean (types: org.springframework.cloud.config.server.encryption.TextEncryptorLocator; SearchStrategy: all) found bean 'singleTextEncryptorLocator'; @ConditionalOnMissingBean (types: org.springframework.cloud.config.server.encryption.EnvironmentEncryptor; SearchStrategy: all) did not find any beans (OnBeanCondition)

   EncryptionAutoConfiguration#singleTextEncryptorLocator matched:
      - @ConditionalOnBean (types: org.springframework.security.crypto.encrypt.TextEncryptor; SearchStrategy: all) found bean 'defaultTextEncryptor'; @ConditionalOnMissingBean (types: org.springframework.cloud.config.server.encryption.TextEncryptorLocator; SearchStrategy: all) did not find any beans (OnBeanCondition)

   EncryptionBootstrapConfiguration matched:
      - @ConditionalOnClass found required class 'org.springframework.security.crypto.encrypt.TextEncryptor' (OnClassCondition)

   EncryptionBootstrapConfiguration.RsaEncryptionConfiguration matched:
      - @ConditionalOnClass found required class 'org.springframework.security.rsa.crypto.RsaSecretEncryptor' (OnClassCondition)
      - Key found in Environment (EncryptionBootstrapConfiguration.KeyCondition)

   EncryptionBootstrapConfiguration.RsaEncryptionConfiguration#rsaProperties matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.bootstrap.encrypt.RsaProperties; SearchStrategy: all) did not find any beans (OnBeanCondition)

   EnvironmentRepositoryConfiguration#defaultConfigTokenProvider matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.config.server.environment.ConfigTokenProvider; SearchStrategy: all) did not find any beans (OnBeanCondition)

   EnvironmentRepositoryConfiguration#multipleJGitEnvironmentProperties matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties; SearchStrategy: current) did not find any beans (OnBeanCondition)

   EnvironmentRepositoryConfiguration.DefaultEnvironmentWatch matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.config.server.environment.EnvironmentWatch; SearchStrategy: all) did not find any beans (OnBeanCondition)

   EnvironmentRepositoryConfiguration.JGitFactoryConfig matched:
      - @ConditionalOnClass found required class 'org.eclipse.jgit.api.TransportConfigCallback' (OnClassCondition)

   EnvironmentRepositoryConfiguration.JGitFactoryConfig#gitCredentialsProviderFactory matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.config.server.support.GitCredentialsProviderFactory; SearchStrategy: all) did not find any beans (OnBeanCondition)

   EnvironmentRepositoryConfiguration.JGitHttpClientConfig matched:
      - @ConditionalOnClass found required classes 'org.apache.http.client.HttpClient', 'org.eclipse.jgit.api.TransportConfigCallback' (OnClassCondition)

   EnvironmentRepositoryConfiguration.JdbcFactoryConfig matched:
      - @ConditionalOnClass found required class 'org.springframework.jdbc.core.JdbcTemplate' (OnClassCondition)
      - @ConditionalOnProperty (spring.cloud.config.server.jdbc.enabled) matched (OnPropertyCondition)

   EnvironmentRepositoryConfiguration.JdbcFactoryConfig#jdbcEnvironmentRepositoryFactory matched:
      - @ConditionalOnBean (types: org.springframework.jdbc.core.JdbcTemplate; SearchStrategy: all) found bean 'jdbcTemplate' (OnBeanCondition)

   EnvironmentRepositoryConfiguration.JdbcFactoryConfig#propertiesResultSetExtractor matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.config.server.environment.JdbcEnvironmentRepository$PropertiesResultSetExtractor; SearchStrategy: all) did not find any beans (OnBeanCondition)

   EnvironmentRepositoryConfiguration.VaultFactoryConfig matched:
      - @ConditionalOnMissingClass did not find unwanted class 'org.springframework.vault.core.VaultTemplate' (OnClassCondition)

   EnvironmentRepositoryConfiguration.VaultHttpClientConfig matched:
      - @ConditionalOnClass found required class 'org.apache.http.client.HttpClient'; @ConditionalOnMissingClass did not find unwanted class 'org.springframework.vault.core.VaultTemplate' (OnClassCondition)

   JdbcRepositoryConfiguration matched:
      - @ConditionalOnClass found required class 'org.springframework.jdbc.core.JdbcTemplate' (OnClassCondition)
      - @ConditionalOnProperty (spring.cloud.config.server.jdbc.enabled) matched (OnPropertyCondition)

   PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer matched:
      - @ConditionalOnMissingBean (types: org.springframework.context.support.PropertySourcesPlaceholderConfigurer; SearchStrategy: current) did not find any beans (OnBeanCondition)

   VaultRepositoryConfiguration matched:
      - @ConditionalOnMissingClass did not find unwanted class 'org.springframework.vault.core.VaultTemplate' (OnClassCondition)

Negative matches:
-----------------

   CompositeRepositoryConfiguration#searchPathCompositeEnvironmentRepository:
      Did not match:
         - @ConditionalOnSearchPathLocator org.springframework.cloud.config.server.environment.SearchPathLocator is not available (OnSearchPathLocatorPresent)

   ConfigServiceBootstrapConfiguration#configServicePropertySource:
      Did not match:
         - @ConditionalOnProperty (spring.cloud.config.enabled) found different value in property 'spring.cloud.config.enabled' (OnPropertyCondition)

   ConfigServiceBootstrapConfiguration.RetryConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required classes 'org.springframework.retry.annotation.Retryable', 'org.aspectj.lang.annotation.Aspect' (OnClassCondition)

   DefaultRepositoryConfiguration:
      Did not match:
         - @ConditionalOnMissingBean (types: org.springframework.cloud.config.server.environment.EnvironmentRepository; SearchStrategy: current) found beans of type 'org.springframework.cloud.config.server.environment.EnvironmentRepository' compositeEnvironmentRepository (OnBeanCondition)

   DefaultTextEncryptionAutoConfiguration#defaultLocatorBasedTextEncryptor:
      Did not match:
         - @ConditionalOnBean (types: org.springframework.cloud.config.server.encryption.TextEncryptorLocator; SearchStrategy: all) did not find any beans of type org.springframework.cloud.config.server.encryption.TextEncryptorLocator (OnBeanCondition)

   DiscoveryClientConfigServiceBootstrapConfiguration:
      Did not match:
         - @ConditionalOnProperty (spring.cloud.config.discovery.enabled) did not find property 'spring.cloud.config.discovery.enabled' (OnPropertyCondition)

   EncryptionBootstrapConfiguration#keyProperties:
      Did not match:
         - @ConditionalOnMissingBean (types: org.springframework.cloud.bootstrap.encrypt.KeyProperties; SearchStrategy: all) found beans of type 'org.springframework.cloud.bootstrap.encrypt.KeyProperties' keyProperties (OnBeanCondition)

   EncryptionBootstrapConfiguration.RsaEncryptionConfiguration#textEncryptor:
      Did not match:
         - @ConditionalOnMissingBean (types: org.springframework.security.crypto.encrypt.TextEncryptor; SearchStrategy: all) found beans of type 'org.springframework.security.crypto.encrypt.TextEncryptor' defaultTextEncryptor (OnBeanCondition)

   EncryptionBootstrapConfiguration.VanillaEncryptionConfiguration:
      Did not match:
         - @ConditionalOnMissingClass found unwanted class 'org.springframework.security.rsa.crypto.RsaSecretEncryptor' (OnClassCondition)

   EnvironmentRepositoryConfiguration.AwsParameterStoreFactoryConfig:
      Did not match:
         - @ConditionalOnClass did not find required class 'software.amazon.awssdk.services.ssm.SsmClient' (OnClassCondition)

   EnvironmentRepositoryConfiguration.AwsS3FactoryConfig:
      Did not match:
         - @ConditionalOnClass did not find required class 'software.amazon.awssdk.services.s3.S3Client' (OnClassCondition)

   EnvironmentRepositoryConfiguration.AwsSecretsManagerFactoryConfig:
      Did not match:
         - @ConditionalOnClass did not find required class 'software.amazon.awssdk.services.secretsmanager.SecretsManagerClient' (OnClassCondition)

   EnvironmentRepositoryConfiguration.ConfigServerActuatorConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.boot.actuate.health.AbstractHealthIndicator' (OnClassCondition)

   EnvironmentRepositoryConfiguration.ConsulEnvironmentWatchConfiguration:
      Did not match:
         - @ConditionalOnProperty (spring.cloud.config.server.consul.watch.enabled) did not find property 'spring.cloud.config.server.consul.watch.enabled' (OnPropertyCondition)

   EnvironmentRepositoryConfiguration.CredhubFactoryConfig:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.credhub.core.CredHubOperations' (OnClassCondition)

   EnvironmentRepositoryConfiguration.GoogleSecretManagerFactoryConfig:
      Did not match:
         - @ConditionalOnClass did not find required class 'com.google.cloud.secretmanager.v1.SecretManagerServiceClient' (OnClassCondition)

   EnvironmentRepositoryConfiguration.RedisFactoryConfig:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.data.redis.core.StringRedisTemplate' (OnClassCondition)

   EnvironmentRepositoryConfiguration.SpringVaultFactoryConfig:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.vault.core.VaultTemplate' (OnClassCondition)

   EnvironmentRepositoryConfiguration.SvnFactoryConfig:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.tmatesoft.svn.core.SVNException' (OnClassCondition)

   GoogleCloudSourceConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'com.google.auth.oauth2.GoogleCredentials' (OnClassCondition)

   GoogleSecretManagerRepositoryConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'com.google.cloud.secretmanager.v1.SecretManagerServiceClient' (OnClassCondition)

   RedisRepositoryConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.data.redis.core.StringRedisTemplate' (OnClassCondition)

   RsaEncryptionAutoConfiguration:
      Did not match:
         - @ConditionalOnProperty (encrypt.key-store.location) did not find property 'location' (OnPropertyCondition)
      Matched:
         - @ConditionalOnClass found required class 'org.springframework.security.rsa.crypto.RsaSecretEncryptor' (OnClassCondition)

   SpringVaultRepositoryConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.vault.core.VaultTemplate' (OnClassCondition)

   VaultConfiguration#vaultConfigTokenProvider:
      Did not match:
         - @ConditionalOnProperty (spring.cloud.config.server.vault.token) did not find property 'spring.cloud.config.server.vault.token' (OnPropertyCondition)

   VaultConfiguration.VaultClientAuthenticationProviderConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.vault.core.VaultTemplate' (OnClassCondition)

Exclusions:
-----------

    None

Unconditional classes:
----------------------

    None
ryanjbaxter commented 11 months ago

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.

rohitdev commented 11 months ago

Thanks for your response @ryanjbaxter , here is the git project https://github.com/rohitdev/spring-config-embed-jdbc-tmpl-project

ryanjbaxter commented 10 months ago

The problem here is that you are trying to resolve a property coming from a remote configuration source in a bootstrap configuration file when we have yet to fetch the configuration from the remote source and populate the environment.

If the property was resolved during the main application context, there would not be an issue. We do not support this configuration where you are trying to bootstrap the config server and relying and configuration that is present in remote configuration files.