-
Oct 2nd, 2008, 03:02 AM
#1
@ResourceBundles and @ExternalValue for @Component
Can @ResourceBundles/@ExternalValue combination or something similar be used for @Component annotated POJOs to inject property values from ".properties" files to bean fields?
If not, wouldn't it be useful? Since PropertyPlaceholderConfigurer and PropertiesFactoryBean are simple, powerful and easy to use, maybe @ResourceBundle is not needed or could be optional for such feature. IMO it would be great if one could just configure PropertyPlaceholderConfigurer in an spring context XML and then just use @ExternalValue on @Component bean field to have properties from PropertyPlaceholderConfigurer injected - in case of @ResourceBundle presence that it should be primary source of properties for @ExternalValue.
Whether one wants to have POJO/package, which is already being scanned for @Component through "context:component-scan" tag, also additionally scanned for @ExternalValue annotations, maybe just some additional attribute to component-scan would be enough to flag desired behavior.
-
Oct 2nd, 2008, 02:28 PM
#2
@ResourceBundles was removed in favor of @PropertiesValueSource in M4-snapshots (per http://jira.springframework.org/browse/SJC-169).
-Arul
-
Oct 4th, 2008, 07:19 AM
#3
Thank you, Arul. Hopefully we won't wait long for the final release, with reference guide covering usage of @PropertiesValueSource. I'm hoping too, that @PropertiesValueSource will be usable on plain @Component, without @Config.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules