SpringCloud更新H版之后启动SpringBoot项目出现如下报错
java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml'
只需要看这一句就可以了
yml文件:
spring:
application:
name: spring-cloud-eureka
server:
port: 8761
eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
报错原因:无法正确识别配置文件
看了半天也没发现配置文件有什么问题,之后想到可能是因为新建工程配置文件无法识别,修改一下编码就OK了。
解决方案:将IDEA设置中的编码格式改为UTF-8,讲下图两处更改即可