Results 1 to 3 of 3

Thread: @ResourceBundles and @ExternalValue for @Component

  1. #1
    Join Date
    May 2007
    Posts
    157

    Default @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.

  2. #2
    Join Date
    Aug 2008
    Location
    Billings, Montana
    Posts
    47

    Default

    @ResourceBundles was removed in favor of @PropertiesValueSource in M4-snapshots (per http://jira.springframework.org/browse/SJC-169).

    -Arul

  3. #3
    Join Date
    May 2007
    Posts
    157

    Default

    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
  •