Announcement Announcement Module

JavaConfig forum decommissioned in favor of Core Container

As described at

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:

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at
See more
See less
Optional @ExternalValue's Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Optional @ExternalValue's

    It would be nice if an @ExternalValue didn't exist, one could mark the annotation as being optional, and it would set the field to null, instead of throwing an exception if it didn't exist.

    For example, in our application, I would like it to be optional to set the following c3p0 database pooling properties

    * maxConnectionAge
    * maxIdleTime
    * maxIdleTimeExcessConnections

    So if we don't see them in the properties file, the field would be null.

    Right now, we need to list the property in the file with an empty value, which makes the file a little longer.

    This is more of a nice to have feature.

    However, this could be a way of distinguishing between non-existent settings and a setting value with an empty string.

  • #2
    As you may be aware, JavaConfig functionality is moving into Spring core for the 3.0 release. As part of that move, @ExternalValue has been replaced by the much more powerful combination of @Value and Spring Expression Language (EL).

    I would recommend taking a look at the nightly snapshots for 3.0, or give the 3.0 M3 milestone release a spin as soon as it drops. Try out @Value, and please do provide feedback. There are interesting implications around behavior when expressions do not resolve, and we'd like to get user input on that.

    In the meantime, of course, you can continue to use JavaConfig milestones to good effect. Please keep in mind,however, that @ExternalValue won't be supported any longer and you'll eventually need to switch.


    • #3
      Thanks Chris, I'll check out M3. How soon is it going to be released? It sounds like it'll be out any day for the last few weeks


      • #4
        Just checking if this has been released yet? As I'd love to grab it when it is =)


        • #5
          Indeed it has!