ResourceBundle.getBundle("", Locale.getDefault()).getString(request_type)SpringBoot可以通过这种方式读取到项目中的properties文件,其中“”填写文件名。文件放在src/main/resource目录下面。注意,这里会加载eclipse工作空间下所有项目的resource目录下的properties文件,如果有另外一个项目也使用了相同了properties文件名,那么你读取的properties文件可能就不是你想要的properties文件了。
SpringBoot项目读取properties文件
最新推荐文章于 2024-03-01 14:25:29 发布