老项目 spring4.2 升级为springboot 2.4的时候有类
@PropertySource("classpath:filePath.properties")
启动的时候报错,
Caused by: java.io.FileNotFoundException: class path resource [filePath.properties] cannot be opened because it does not exist
检查发现在spring中,这个文件放在 src/main/java 下,现在在springboot中这样就找不到,需要挪到 src/main/resource 下面。
本文介绍了从Spring4.2升级到SpringBoot2.4时遇到的文件加载问题。具体表现为原本放置于src/main/java下的配置文件无法被正确加载。解决办法是将文件移至src/main/resources目录下。
1万+

被折叠的 条评论
为什么被折叠?



