Announcement Announcement Module
Collapse

JavaConfig forum decommissioned in favor of Core Container

As described at

http://static.springsource.org/sprin...fig/README.TXT

key features of the Spring JavaConfig project have been migrated into the core Spring Framework as of version 3.0.

Please see the Spring 3.0 documentation on @Configuration and @Bean support:

http://static.springsource.org/sprin...tml#beans-java

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at

http://forum.springsource.org/forumdisplay.php?f=26
See more
See less
@ResourceBundles and @ExternalValue for @Component Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @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
    @ResourceBundles was removed in favor of @PropertiesValueSource in M4-snapshots (per http://jira.springframework.org/browse/SJC-169).

    -Arul

    Comment


    • #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.

      Comment

      Working...
      X