Describe the bug I am creating config-server with latest spring cloud version
Sample
security:
user:
username:
password:
spring:
application:
name: config-server
server:
port: 8888
management:
info:
env:
enabled: true
build:
enabled: true
endpoint:
health:
show-details: always
endpoints:
web:
exposure:
include: "*"
jmx:
exposure:
include: "*"
---
spring:
profiles:
active: composite
cloud:
config:
server:
composite:
- type: git
uri: <git url>
username: ${GIT_USER}
password: ${GIT_PASS}
search-paths: '{application}'
cloneOnStart: true
force-pull: true
order: 2
Please address this as soon as possible. it is hard stopper to use latest spring version
Comment From: ryanjbaxter
Please describe the problem
Comment From: voodemsanthosh
Problem:
I am developing a config server with above given spring cloud version and spring profile with composite is not accepting.
with this configuration:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.0-M3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.ex.configserver</groupId>
<artifactId>config-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>config-server</name>
<description>API is used to implement Spring config server</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>2020.0.3-SNAPSHOT</spring-cloud.version>
</properties>
getting this error:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled." }
{ "date_time":"2021-03-26 17:01:00,227", "thread":"[main]", "class_name":"LoggingFailureAnalysisReporter", "serviceName":"serviceName", "id":, "log_message":"
***************************
APPLICATION FAILED TO START
***************************
Description:
Invalid config server configuration.
Action:
If you are using the git profile, you need to set a Git URI in your configuration. If you are using a native profile and have spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.
" }
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:11 min
[INFO] Finished at: 2021-03-26T17:01:00+05:30
[INFO] Final Memory: 27M/104M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.5.0-M3:run (default-cli) on project prd-config-server: Application finished with exit code: 1 -> [Help 1]
if I use this configuration:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!--<version>2.5.0-M3</version>-->
<version>2.3.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.ex.configserver</groupId>
<artifactId>config-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>config-server</name>
<description>API is used to implement Spring config server</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>Hoxton.SR9</spring-cloud.version>
</properties>
No issues occurring
Comment From: ryanjbaxter
Can you please try with Spring Boo 2.4.4 and Spring Cloud 2020.0.2?
Comment From: voodemsanthosh
I have same issue after updating,
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!--<version>2.5.0-M3</version>-->
<!--<version>2.3.8.RELEASE</version>-->
<version>2.4.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<spring-cloud.version>2020.0.2</spring-cloud.version>
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled." }
{ "date_time":"2021-03-26 19:22:50,928", "thread":"[main]", "class_name":"LoggingFailureAnalysisReporter", "serviceName":"serviceName", "ex":, "log_message":"
***************************
APPLICATION FAILED TO START
***************************
Description:
Invalid config server configuration.
Action:
If you are using the git profile, you need to set a Git URI in your configuration. If you are using a native profile and have spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.
" }
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.363 s
[INFO] Finished at: 2021-03-26T19:22:50+05:30
[INFO] Final Memory: 27M/97M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.4.4:run (default-cli) on project prd-config-server: Application finished with exit code: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Process finished with exit code 1
Comment From: KuSh
Hello,
I have the same problem, for me this is due to commit https://github.com/spring-cloud/spring-cloud-config/commit/2ea5e11c9a2c992890fbd8c698e3d6d64e67d99b introducing a check for correct configuration (app was working before that).
My app was disabling spring cloud in the default bootstrap.yml (no profile) but it doesn't seem to work anymore
Configuring spring.cloud.config.enabled=false or spring.cloud.config.import-check.enabled=false in application.yml correct the problem but doesn't seem to be the right solution.
I'm trying to see why the bootstrapEnabled(environment) || useLegacyProcessing(environment)
test in spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServerConfigDataMissingEnvironmentPostProcessor.java didn't pickup ... I'll get back at you
regards, Nicolas
Comment From: KuSh
Hello,
Configuring spring.cloud.bootstrap.enabled=true in application.yml solved the issue for me. It wasn't obvious to me that it was "not enabled" by default, as the only mention of that property in spring-cloud documentation is a negation
You can disable the bootstrap process completely by setting spring.cloud.bootstrap.enabled=false (e.g. in System properties).
I'm reading that as it being enabled by default but it doesn't seem to be "completly" the case and spring-cloud-common define its default (in PropertyUtils) to false.
And documentation is not super clear (at least for a non native english like me) as to what is the default
extract from https://cloud.spring.io/spring-cloud-static/spring-cloud.html#_spring_cloud_context_application_context_services
"applicationConfig: [classpath:bootstrap.yml]" (and friends if Spring profiles are active). If you have a bootstrap.yml (or properties) then those properties are used to configure the Bootstrap context, and then they get added to the child context when its parent is set. They have lower precedence than the application.yml (or properties) and any other property sources that are added to the child as a normal part of the process of creating a Spring Boot application. See below for instructions on how to customize the contents of these property sources.
So bootstrap.yml is taken into account but after application.yml but configure the Bootstrap context without setting spring.cloud.bootstrap.enabled ... I'm lost
regards, Nicolas
Comment From: spencergibb
This is the latest documentation https://docs.spring.io/spring-cloud-config/docs/3.0.3/reference/html/#_spring_cloud_config_client
Comment From: KuSh
This is the latest documentation https://docs.spring.io/spring-cloud-config/docs/3.0.3/reference/html/#_spring_cloud_config_client
Thanks !
Comment From: ryanjbaxter
@voodemsanthosh 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.
Comment From: voodemsanthosh
@voodemsanthosh 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.
Please use this Link for git project.
Comment From: spencergibb
@voodemsanthosh 2 items. bootstrap.yml
is no longer read by default. See the release notes for details. Renaming it to application.yml fixes the issue.
Also, config server does not support running as a webflux application, watch #885 if your are interested in that.
Comment From: voodemsanthosh
Thank you @spencergibb, it is working with your suggestions.