简体   繁体   English

在v1.5.12的Spring Boot中从类路径加载Spring Resource文件有什么变化?

[英]What changed about loading Spring Resource file from classpath in Spring Boot in v1.5.12?

Prior to Spring Boot v1.5.11, the following worked for referring to a file called auth.json in src/main/resources : spring.cloud.gcp.credentials.location=auth.json 在Spring Boot v1.5.11之前,以下内容用于引用src/main/resources一个名为auth.json的文件: spring.cloud.gcp.credentials.location=auth.json

Starting with v1.5.11 and continuing through into 1.5.12, the above results in a FileNotFound exception. 从v1.5.11开始,一直持续到1.5.12,以上结果导致FileNotFound异常。 But the following works: spring.cloud.gcp.credentials.location=classpath:auth.json 但是以下工作原理: spring.cloud.gcp.credentials.location=classpath:auth.json

What changed in Spring Boot 1.5.12 (or its underlying dependencies) that was responsible for this? 在Spring Boot 1.5.12(或其底层依赖项)中发生了什么变化?

This was caused by a fix to another issue and is being tracked via another reported instance here: https://github.com/spring-projects/spring-boot/issues/12786 这是由另一个问题的修复引起的,正在通过另一个报告的实例进行跟踪: https//github.com/spring-projects/spring-boot/issues/12786

Practitioners hitting this behavior may either update their implementation in an appropriate way (eg, in our sanitized sample, it would be to prefix the property with "classpath:") or to wait to see if further resolution (that doesn't regress the other fix that caused this) is possible. 实施此行为的实践者可能会以适当的方式更新其实现(例如,在我们经过清理的示例中,将在属性前面加上“ classpath:”),或者等待是否有进一步的解决方案(不会使其他方法退步)解决导致此问题的可能性)。

h/t @Stephane-Nicoll and Andy Wilkinson. h / t @ Stephane-Nicoll和Andy Wilkinson。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM