When i use the method 'private Banner getTextBanner(Environment environment) ' in SpringBoot, it will use the method of getResource(String location) in Spring 6.0, the return object Resource always is false for resource.exists(). I try use different path, but all of them are unused, such as classpath:banner.txt, /banner.txt, banner.txt. So why the path like application.properties can get correct, but banner is wrong. This is my project resouces contents: SpringBoot the method getResource(String location) is always return null

Comment From: philwebb

@myheavyhead Can you please provide a sample application that replicates the problem.

Comment From: myheavyhead

@philwebb url: https://gitee.com/heavyHead/Mercury/tree/dev/, I don't know why the src/resources/config/banner.txt does not take effect. Thank you.

Comment From: wilkinsona

@myheavyhead The custom banner is loaded from classpath:/banner.txt but you have placed it in classpath:/config/banner.txt. Moving the file up one directory should fix the problem. Alternatively, you can configure a custom location using spring.banner.location.

So why the path like application.properties can get correct, but banner is wrong.

Application properties files (in .properties or .yaml format) are loaded from both classpath:/ and classpath:/config.

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.external-config.files