Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PropertyPlaceholderConfigurer vs ReloadableResourceBundleMessageSource

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?

like image 647
Arun Avatar asked Oct 21 '22 18:10

Arun


2 Answers

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.

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

like image 119
Arun Avatar answered Oct 24 '22 01:10

Arun


PropertyPlaceholderConfigurer used for properties files to be used in the application context or inside the code with with @value.

ResourceBundleMessageSource used for Internationalization & Localization (i18n) of messages you want to show to the user, within jsp direct, or from your code by wiring message resources bean inside your component.

like image 34
Bassem Reda Zohdy Avatar answered Oct 24 '22 00:10

Bassem Reda Zohdy