错误提示:
Application failed to start due to an exception
org.springframework.cloud.config.client.ConfigServerConfigDataMissingEnvironmentPostProcessor$ImportException: No spring.config.import set
建议的解决方案:
***************************
APPLICATION FAILED TO START
***************************
Description:
No spring.config.import property has been defined
Action:
Add a spring.config.import=configserver: property to your configuration.
If configuration is not required add spring.config.import=optional:configserver: instead.
To disable this check, set spring.cloud.config.enabled=false or
spring.cloud.config.import-check.enabled=false.
解决方案
server:
port: 8003
spring:
application:
name: config-server #应用名称,别名
cloud:
config:
server:
git:
uri: git仓库的地址
search-paths: 搜索路径
default-label: 分支
server.port=8004
spring.profiles.active=dev
spring.application.name=config-client
spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.service-id=config-server
spring.config.import=optional:configserver:http://localhost:8003
spring.cloud.config.name=${spring.application.name}
spring.cloud.config.profile=${spring.profiles.active}
就是这样了。。。
评论:
**用户ToDoMyBest6534**:我也遇到这个问题,我看了官网,原来springcloud2020 版本 把Bootstrap被默认禁用,
同时spring.config.import加入了对解密的支持。对于Config Client、Consul、Vault和Zookeeper的配置导入,
如果你需要使用原来的配置引导功能,
那么需要将org.springframework.cloud:spring-cloud-starter-bootstrap依赖引入到工程中