Results 1 to 6 of 6

Thread: What Happend to @PropertiesValueSource and @ExternalValue

  1. #1
    Join Date
    Apr 2005
    Posts
    27

    Default What Happend to @PropertiesValueSource and @ExternalValue

    What happend to @PropertiesValueSource and @ExternalValue when JavaConfig was merged into Spring Core?

  2. #2
    Join Date
    Apr 2005
    Posts
    27

    Default

    Unfortunately, the release notes were far from helpful:

    "* introduced annotated @Bean factory methods and JavaConfig-style @Configuration classes" - http://static.springframework.org/sp.../changelog.txt

  3. #3
    Join Date
    Apr 2007
    Posts
    307

    Default

    @ExternalValue, @PropertiesValueSource (and the other *ValueSource annotations) have all been supplanted by Spring 3.0's @Value annotation and use of Spring EL. The reference documentation is just shaping up around this now. Search for those terms, and please post any questions you have afterward.
    Chris Beams
    Spring Framework committer, VMware
    http://github.com/cbeams

  4. #4
    Join Date
    Apr 2005
    Posts
    27

    Default

    Chris,

    I do not see an annotated equivalent of PropertiesValueSource, <property-placeholder />, or PropertyPlaceholderConfigurer. I was expecting to be able to reference the location of my properties file without having to use XML.

    - Nick

  5. #5
    Join Date
    Apr 2007
    Posts
    307

    Default

    Nick,

    Take a look at this issue: http://jira.springframework.org/browse/SPR-5682. Please vote for it, and consider adding an issue requesting pure-java support for property-placeholder like functionality.

    It's user feedback just like this that we're looking for as we decide what should make it into core. Thanks.

    - C
    Chris Beams
    Spring Framework committer, VMware
    http://github.com/cbeams

  6. #6
    Join Date
    Jul 2005
    Posts
    10

    Default

    Hi,
    I'm using <context: property-placeholder> to load some settings from a properties file, and I'm also using Spring annotations to configure my application with minimal XML.

    I can't figure out a way to access properties in the Spring annotations. I want to do something like @Value("#{myProperty}"), just like I can normally do in the XML when using the property-placeholder.

    This thread and the mentioned issue lead me to believe this is currently not possible. Is that true? Is there any way to simulate this with SpringEL?

    Otherwise, what's the best way to deal with this right now? In my case I am using Spring MVC annotations, and it looks like if I try to redefine my controller bean in XML I get duplicate controllers. So should I define a separate XML-based Configuration bean and inject that into my controllers?

    BTW I am using Spring 3.0 M3.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •