Spring 类路径上存在冲突的多个application.yml

Spring 类路径上存在冲突的多个application.yml,spring,spring-boot,Spring,Spring Boot,我有以下项目设置: Spring-Boot-App 1: src/main/resources/application.yml Dependency-Spring-Boot-App-2.jar: src/main/resources/application.yml 但是第二个application.yml被忽略了!是我做错了什么,还是这是默认的spring行为?如何加载第二个application.yml以使我的app 1可以使用所有属性?类路径上两个名称完全相同的资源。ClassLoade

我有以下项目设置:

Spring-Boot-App 1:
src/main/resources/application.yml

Dependency-Spring-Boot-App-2.jar:
src/main/resources/application.yml

但是第二个application.yml被忽略了!是我做错了什么,还是这是默认的spring行为?如何加载第二个application.yml以使我的app 1可以使用所有属性?

类路径上两个名称完全相同的资源。ClassLoader加载第一个资源,因此行为是预期的。

类路径上有两个名称完全相同的资源。ClassLoader加载第一个答案。你的答案是有道理的,是的,但这是spring boot,在这里你可以忘记通常的预期。如果你写了一个实际的答案,我可以将它标记为已解决