PropertyPlaceholderConfigurer 与 ReloadableResourceBundleMessageSource [英] PropertyPlaceholderConfigurer vs ReloadableResourceBundleMessageSource

查看:86
本文介绍了PropertyPlaceholderConfigurer 与 ReloadableResourceBundleMessageSource的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Google 上搜索如何在 Spring 3 中配置属性文件,我得到了许多不同的答案.我发现 ReloadableResourceBundleMessageSourcePropertyPlaceholderConfigurer 可用于从属性文件中获取属性.有人可以解释一下这些之间的区别吗?

Searching Google on how to configure property file in Spring 3 and I got many different answers. I found that ReloadableResourceBundleMessageSource and PropertyPlaceholderConfigurer can be used for getting properties from property files. Can somebody please explain the difference between these?

推荐答案

PropertyPlaceholderConfigurer

我们使用PropertyPlaceholderConfigurer来加载一些spring的applicationcontext.xml中用到的属性文件.我们可以直接使用 JSTL 表达式使用属性.

PropertyPlaceholderConfigurer

We use PropertyPlaceholderConfigurer when we need to load some property files whose properties are used in applicationcontext.xml of spring. We can use the properties directly using JSTL expressions.

当我们需要使用 applicationcontext.xml 之外的属性文件时,我们使用 ReloadableResourceBundleMessageSource.在 applicationcontext.xml 中无法访问使用 ReloadableResourceBundleMessageSource 加载的属性

We use ReloadableResourceBundleMessageSource when we need to use the property files outside the applicationcontext.xml. The properties loaded using ReloadableResourceBundleMessageSource are not accessible in applicationcontext.xml

这篇关于PropertyPlaceholderConfigurer 与 ReloadableResourceBundleMessageSource的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆