Failed to load property source from location 'classpath:/bootstrap.yml'
2020-06-01 04:19
856 查看
使用springcloud架构新增模块后出现如下问题:
[code]java.lang.IllegalStateException: Failed to load property source from location 'classpath:/bootstrap.yml' at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:552) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension(ConfigFileApplicationListener.java:503) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:470) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$6(ConfigFileApplicationListener.java:451) at java.lang.Iterable.forEach(Iterable.java:75) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$7(ConfigFileApplicationListener.java:450) at java.lang.Iterable.forEach(Iterable.java:75) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:447) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:336) at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:215) at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:198) at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:185) at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:171) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74) at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54) at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:338) at org.springframework.boot.SpringApplication.run(SpringApplication.java:297) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:137) at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:208) at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:104) at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:70) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74) at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54) at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:338) at org.springframework.boot.SpringApplication.run(SpringApplication.java:297) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) at com.cloud.learn.ProductProvider_Config_8001.main(ProductProvider_Config_8001.java:24) Caused by: org.yaml.snakeyaml.reader.ReaderException: special characters are not allowed at org.yaml.snakeyaml.reader.StreamReader.checkPrintable(StreamReader.java:67) at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:248) at org.yaml.snakeyaml.reader.StreamReader.<init>(StreamReader.java:58) at org.yaml.snakeyaml.Yaml.loadAll(Yaml.java:537) at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:166) at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:139) at org.springframework.boot.env.OriginTrackedYamlLoader.load(OriginTrackedYamlLoader.java:75) at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:50) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadDocuments(ConfigFileApplicationListener.java:570) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:526) ... 35 common frames omitted
解决:
1. 有可能是你新增文件时不小心 复制多了空格,可以直接拿已经创建好的文件,再更改 文件中的配置。
2. 有可能是 你文件中 的一些注释有影响 , 仔细检查一下。
相关文章推荐
- Spring boot bootstrap.yml文件使用遇见的坑Failed to load property source from location 'classpath:/bootstrap.
- springboot配置文件 application.yml注意事项(Failed to load property source from location 'classpath:/applica)
- Failed to load property source from location 'classpath:/application.yml'
- Failed to load property source from location 'classpath:/application.yml'
- 关于Configuration problem: Failed to import bean definitions from URL location [classpath:spring-jdbc.
- 使用cxf创建webservice发生“Failed to import bean definitions from URL location [classpath:META-INF/cxf/cxf”
- elasticsearch按照配置时遇到的一些坑 [Failed to load settings from [elasticsearch.yml]]
- elasticsearch配置文件里的一些坑 [Failed to load settings from [elasticsearch.yml]]
- elasticsearch配置文件里的一些坑 [Failed to load settings from [elasticsearch.yml]]
- elasticsearch按照配置时遇到的一些坑 [Failed to load settings from [elasticsearch.yml]]
- elasticsearch按照配置时遇到的一些坑 [Failed to load settings from [elasticsearch.yml]]
- Failed to read the 'localStorage' property from 'Window' 的解决办法
- openfire源码在eclipse中运行,Failed to load admin-sidebar.xml file from Openfire classes
- Failed to load Main-Class manifest attribute from
- Failed to import bean definitions from relative location [config/*.xml]
- 报错:Unable to load schema mappings from location [META-INF/spring.schemas]
- There was a failure executing the receive pipeline document specification from assembly failed to load
- Could not copy property 'id' from source to target异常
- [ERROR]Failed to load driver class com.microsoft.sqlserver.jdbc.SQLServerDriver from HikariConfig cl
- 运行jar 提示 Failed to load Main-Class manifest attribute from