SpringBoot项目读取properties文件

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

猜你喜欢

转载自blog.csdn.net/wenyan_liu/article/details/80894114