Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring boot 2.4.6 load config error #26680

Closed
mengxianglu opened this issue May 27, 2021 · 5 comments
Closed

spring boot 2.4.6 load config error #26680

mengxianglu opened this issue May 27, 2021 · 5 comments
Labels
status: duplicate A duplicate of another issue

Comments

@mengxianglu
Copy link

mengxianglu commented May 27, 2021

As long as there is a config folder in the root directory of the project, it will start to report an error

image

12:30:51.961 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: No subdirectories found for mandatory directory location 'file:./config/*/'.
 at org.springframework.util.Assert.state(Assert.java:76)
 at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolvePatternEmptyDirectories(StandardConfigDataLocationResolver.java:268)
 at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolveEmptyDirectories(StandardConfigDataLocationResolver.java:257)
 at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolveEmptyDirectories(StandardConfigDataLocationResolver.java:248)
 at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolve(StandardConfigDataLocationResolver.java:239)
 at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolve(StandardConfigDataLocationResolver.java:117)
 at org.springframework.boot.context.config.ConfigDataLocationResolvers.lambda$resolve$1(ConfigDataLocationResolvers.java:115)
 at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:126)
 at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:115)
 at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:107)
 at org.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:105)
 at org.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:97)
 at org.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:85)
 at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:121)
 at org.springframework.boot.context.config.ConfigDataEnvironment.processInitial(ConfigDataEnvironment.java:243)
 at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:230)
 at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:102)
 at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:94)
 at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
 at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)
 at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
 at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
 at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
 at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
 at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
 at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
 at java.util.ArrayList.forEach(ArrayList.java:1249)
 at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
 at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
 at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
 at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:375)
 at org.springframework.boot.SpringApplication.run(SpringApplication.java:333)
 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329)
 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318)
 at com.example.demo21.Demo21Application.main(Demo21Application.java:10)
Disconnected from the target VM, address: '127.0.0.1:57162', transport: 'socket'
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 27, 2021
@mamachanko
Copy link

Running into the same issue.

This fails with the mentioned java.lang.IllegalStateException: No subdirectories found for mandatory directory location 'file:./config/*/'.:

$CWD/config/application.yaml

This works as expected:

$CWD/config/anything/application.yaml

@anoopgarlapati
Copy link

Please see #26627. The issue is reported there and there are couple of workarounds provided by Spring team to unblock (Refer comment for workarounds).

@snicoll
Copy link
Member

snicoll commented May 27, 2021

Thanks @anoopgarlapati.

Duplicate of #26627

@snicoll snicoll closed this as completed May 27, 2021
@snicoll snicoll added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels May 27, 2021
@mengxianglu

This comment has been minimized.

@snicoll

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

5 participants